2. How to Translate? Every string (visible to user) surrounded by tr() QLabel mytext(tr("Hello World!")); Load a translation (.qm) file at startup Using tr() is good practice, even though you don't have translation files yet.. they can be added later!
3. tr()? tr() function is a static function defined in QObject QObject::tr(..); tr() returns the translation, if not found, it will return original text // if translation is not found, // "hello" is returned tr("hello")
4. Example #include <QtGui> int main(int argc, char *argv[]) { QApplication a(argc, argv); QLabel mytext(QObject::tr("Hello World!")); mytext.show(); return a.exec(); }
6. Translating Applications Run lupdate to extract all tr strings from the application's source code. Translate the application using Qt Linguist Run lrelease to generate binary .qm files that the app can load using QTranslator (done automatically)
8. 1. lupdate Modify .pro file to specify language support TRANSLATIONS = myapp_fi.ts myapp_fr.ts lupdate will generate these xml-based files lupdate –verbose myapp.pro