TsiLang and GetText procedure

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
magicang
Posts: 12
Joined: Mon May 12, 2003 3:44 am

TsiLang and GetText procedure

Post 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
dorin
Posts: 20
Joined: Thu Nov 21, 2002 3:29 pm
Location: House of Technics
Contact:

Re: TsiLang and GetText procedure

Post 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?
magicang
Posts: 12
Joined: Mon May 12, 2003 3:44 am

Post 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
dorin
Posts: 20
Joined: Thu Nov 21, 2002 3:29 pm
Location: House of Technics
Contact:

Post 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.
magicang
Posts: 12
Joined: Mon May 12, 2003 3:44 am

Post 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
gaivans
Posts: 71
Joined: Fri Nov 29, 2002 4:10 pm

Post 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;
...
Best regards,
Serghei Gaivan
magicang
Posts: 12
Joined: Mon May 12, 2003 3:44 am

Post 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 !!
dorin
Posts: 20
Joined: Thu Nov 21, 2002 3:29 pm
Location: House of Technics
Contact:

Post by dorin »

Try using the GetTextOrDefault method instead of GetText.
magicang
Posts: 12
Joined: Mon May 12, 2003 3:44 am

Post by magicang »

The GetTextOrDefault function also doesn't work for this. :cry:

Any idea ?

Regards,
Magic Ang
magicang
Posts: 12
Joined: Mon May 12, 2003 3:44 am

Post 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
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post 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.
Post Reply