bonami Messages: 186 Registered: June 2007 Location: Beijing
Experienced Member
is there a example?
i've been using .t file and now trying this.
zhcn.tr has been generated. now how to use it?
i removed code below, which i think should be used only for .t files.
and then my program ran in english, i.e, not localized,
bonami Messages: 186 Registered: June 2007 Location: Beijing
Experienced Member
i'm running on winxp (chinese).
in the same folder, are my exe and tr files. the tr file is exported using "file.exe --export-tr zhcn_" and i've checked that it contains chinese translations.
in my code, i've removed the three lines i specified.
source code is like t_("english"). and it runs showing english, too.
(P.S., i wonder how can exe file determine which tr file to use, if i have multiple tr files, without specifying the last line of the 3 lines' code.)
if i readd the three lines, t file is built in the exe and it shows in chinese.
it would be greatly helpful if some examples could be given. thank you very much.
bonami Messages: 186 Registered: June 2007 Location: Beijing
Experienced Member
thank you. i got it. the 3 lines of code is still necessary. my program searches for tr files when running. and which languages is used depends on the last line of the 3.
bonami Messages: 186 Registered: June 2007 Location: Beijing
Experienced Member
i thought i got it but did not. when i included the 3 lines, my program was using static translation.
i've looked into .tr's loading procedure. it seems this mechanism is for replacing existing translations in .t, instead of adding new words' translations.
dolik.rce Messages: 1791 Registered: August 2008 Location: Czech Republic
Ultimate Contributor
Hi bonami,
I've just remembered, that I have an old HelloWorld program that I've created when trying U++ for the first time to explore it's possibilities. It can switch languages in the runtime - if I understand correctly, that is exactly what you are looking for.
All the trick is just calling InitLayout after SetLanguage. I hope this example will help you. The package is in the attachment.
Bye
Honza
bonami Messages: 186 Registered: June 2007 Location: Beijing
Experienced Member
i'm afraid that was not what i meant.
i want to use .tr files, instead of .t files, so that i do not need to provide translations when compiling and user can add their own languages to .tr files when running.