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?
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 ?
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;
...
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.
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;