PDA

View Full Version : Testing automatic language sensing



Jon Heron
5th October 2010, 01:03
Hello all,
I should start off by stating I am a beginner programmer!
I have recently completed my Qt for Symbian app and deployed it to OVI and other various mobile stores.
I just got my first translation of my application completed in Spanish. Here are the steps I used to add the translation to the application;

Selected File->Release in the Qt liguist tool which created the "applicationName_es.qm" file.
Added "TRANSLATIONS = ApplicationName_es.ts" to the pro file.
Added
QString locale = QLocale::system().name();
QTranslator translator;
translator.load(QString("ApplicationName_") + locale);
a.installTranslator(&translator); to main.

Now I would like to see if the translation works...
My version of Windows7 does not support language packs so I used the RDA to load the app on a symbian device, then switched the devices language to Spanish which I would assume should be now detected as ES and intern load the Spanish version of my app... Unfortunately it does not, only the English version is loaded....

How do I test if the translated version is working?
I have tried
translator.load("ApplicationName_es.qm"); and it still shows up in English?
Any and all help would be greatly appreciated!

Cheers,
Jon

wysota
5th October 2010, 02:01
Check what load() returns. Maybe the application simply can't find the translation file. By the way, you can skip the ".qm" part of the file name when calling load().

Jon Heron
5th October 2010, 02:02
:o
Never mind...
I needed to embed the qm file into the resource to make it available during runtime... :cool:
Cheers,
Jon

Jon Heron
5th October 2010, 02:04
Thanks wysota! You are 100% correct.
We must have been posting at the same time. :p
Cheers,
Jon