How to use Language Database

i have a problem about using Language Database function recently.i have created a Language Database including Chinese and USA English,and phab has already created files which named test.zh_CN and test.en_US.Now,i use ApSetTranslation(“zh_CN”) in order to change my application to Chinese,but it cant work,instead,the fuction returnd -1 for FAIL.

i dont know where i have made a mistake,is there anybody who can point it out?thx very much:)

up,i will wait online

Are you running your application from PhAB or are you starting it outside PhAB? Have you set the ABLPATH environment variable on your machine? If so, are your translation files in one of the directories listed in ABLPATH? If you haven’t set ABLPATH, are the translation files in the same directory as the executable?

thx,now this function is working.But when i called this function, i must destroy current window to make the display changed.What can i do to make the display changed (English to Chinese) in another way?

That’s what you have to do. Here’s a note from the Photon Programmer’s Guide:

Any existing modules and widgets aren’t translated, only new ones. If
you want immediate feedback, you need to recreate the modules. This is
easy for dialogs, but more difficult for the base window; remember that
destroying the base window exits the application. One way to translate
the contents of the base window is to put them in a picture module,
which can be recreated.

It seems so strange that my bilingual phab app can only run under PhAB! If in terminal , set ABLANG as : [color=red]
$export ABLANG=de_DE
$./myapp
$pwd
/root/myapp/src/gcc_ntox86

then myapp still run in default language. I have copied myapp.de_DE,myapp.ldb to the directory: myapp/src/gcc_ntox86 where the execution file exists. Also I have set ABLPATH as: [color=red]
$export ABLPATH=root:myapp
What’s the problem? Thanks a lot!