Page 1 of 1

dxgettext to tsi

Posted: Wed Dec 22, 2010 10:13 am
by microtronx
We're currently using dxgettext.

How can we switch to tsi with i.e. following usage:

messagdlg( _('text translated with gettext'+#13+'second line of text'), mtinformation, [mbok],0);

The _() function is a wrapper for gettext(). As i can see, tsi splits the text into two seperate lines / texts.

Thanks for some help,

Yusuf

Posted: Thu Dec 23, 2010 5:30 am
by isiticov
Hello,

After using TsiLang Expert to scan your source code you can just combine the second line into the first one (using Ctrl+Enter or menu Edit | Multiline Editor in Translations Editor). And then delete the call for second GetTextOrDefault() method. Also performing global replace
_( to just ( would be enough to eliminate the call for _() function.

Posted: Thu Dec 23, 2010 6:26 am
by microtronx
Good morning Igor,

is it not possible, that we can extend tsi to scan only texts within _( ... ) + replace only the text.

If this is possible, we can create a new wrapper _() to use tsi instead of gettext.

Posted: Thu Dec 23, 2010 4:16 pm
by isiticov
Hello,

If you don't wish to remove _() call then you can leave the _() function call and let TsiLang translate the content inside of () using TsiLang Expert. Then just create new _() function, something like this:
function _(const S: string): string;
begin
Result := S;
end;
In this way you wouldn't need to make any replacement in your code for _() function.