Page 1 of 1

TsiLang and GetText procedure

Posted: Mon May 12, 2003 3:48 am
by magicang
Hi there,

i'm trying on the GetText procedure for TsiLang, but i'm facing some problem.

If i'm using ,like say, WinXp with chinese support. The GetText procedure can't work properly as it seems that it cannot retrieve the text correctly. :cry:

But if i running my software under native chinese enviroment(e.g, Win98 big5 version). It work correctly.

How can i resolve this issue under WinXp wiv chinese support ? i didn't wan to develop my software and then switch to other OS to c the result.

Regards,
Ang Lik Huar

Re: TsiLang and GetText procedure

Posted: Mon May 12, 2003 7:09 am
by dorin
magicang wrote:If i'm using ,like say, WinXp with chinese support.
What you do you mean by chinese support? Are you sure you set the system locale to chinese? If not, go to Control Panel/Regional and language Options. Switch to Advanced tab. Select Chinese (xxx) from the language list.
It should work then...
magicang wrote:The GetText procedure can't work properly as it seems that it cannot retrieve the text correctly.
What exactly does it return? Question marks, black squares, or just garbage?

Posted: Mon May 12, 2003 7:16 am
by magicang
Hi there,

Thanks for the reply.

I have change the locale to chinese. But trace from the IDE, the gettext get a blank string.

regards,
Ang Lik Huar

Posted: Mon May 12, 2003 8:02 am
by dorin
I tried it on my system. The chinese string returned by GetText looked quite nice to me. (At least it wasn't blank.)

We could not reproduce the bug.
It would be nice if you send us a small sample project so we can track the bug.

Posted: Mon May 12, 2003 8:54 am
by magicang
Hi,

Thanks for the quick reply !! :o

I think i found the problem. Because i add a new language, althought i have increase siLangDispatcher to my new language no. and i load my language file dynamically. This cause the problem.

Now, i manual set the file name for the siLangDispatcher once and run my program. It works.

Does it means that if i add a new language, i need to manaually set the file name for siLangDispatcher again ?

Regards,
magic

Posted: Mon May 12, 2003 9:18 am
by gaivans
Hello,

If you need to load translations dynamically in run-time the preferable way to do it is:

...
if FileExists(TheNewFileName) then
begin
siLangDispatcher1.FileName := TheNewFileName;
siLangDispatcher1.LoadAllFromFile(TheNewFileName);
siLangDispatcher1.ActiveLanguage := TheWorkingLanguageNumber;
end;
...

Posted: Tue May 13, 2003 12:34 pm
by magicang
Hi,

Now i having another problem.

The translation work great under winXp with chinese support. But while i bring the same .exe file and same .sil file to a native chinese OS. I got problem again.

This time, the showmessage dialog doesn't translate. I use somethings like ShowMessage(TsiLang.GetText('xxx')), it work under winxp but doesn't work in native chinese os and it return blank string to me. :cry:

any advice ?

Thanks a lot !!

Posted: Wed May 14, 2003 7:04 am
by dorin
Try using the GetTextOrDefault method instead of GetText.

Posted: Fri May 16, 2003 2:01 am
by magicang
The GetTextOrDefault function also doesn't work for this. :cry:

Any idea ?

Regards,
Magic Ang

Posted: Fri May 16, 2003 7:09 am
by magicang
Hi Dorin,

I think i have found the problem. It seems that althought it have load the language file, some of the things is not refresh.

Look into the source code of TsiLang , i add one more code beside the code u give me and it's work now.


if FileExists(TheNewFileName) then
begin
siLangDispatcher1.FileName := TheNewFileName;
siLangDispatcher1.LoadAllFromFile(TheNewFileName);
siLangDispatcher1.ActiveLanguage := TheWorkingLanguageNumber;
siLang.Loaded; // ?? Force the siLang to refresh it's data ?? Tsilang Bugs ???
end;


Regards,
Magic Ang :o

Posted: Fri May 16, 2003 2:35 pm
by isiticov
Could you please send us the sample project which reproduces such behavior? And we will try to find where exactly the origin of problem is.
Thanks.