[SOLVED] QTranslator not working?
-
Hi guys,
I'm trying out the translator system in QT for the first time.
I fallowed the guide :
http://qt-project.org/doc/qt-5.0/qtdoc/internationalization.html-First genereted the .ts file
-Edited the .ts file with Qt Linguist (completed the translation 100%)
-Compiled the .ts file into .qm file in QtCreatorThe .qm file and .ts file are in the root on my project, here's a screenshot:
https://www.dropbox.com/s/gv2wraan7au8o75/folderProject.pngI specify in my main to load a specific .ts file just for testing, but it still show the english text. (see code below)
Anything I forgot to do?
Thanks in advance /Merci à l'avance :)@int main(int argc, char *argv[]) {
QApplication a(argc, argv); QString locale = QLocale::system().name(); qDebug() << "LOCALE : " << locale; QTranslator translator; translator.load("powervelo_fr"); a.installTranslator(&translator); MainWindow w; w.show(); return a.exec();}@
-
Hi,
Without the rest of your code, it's difficult to say what could be wrong. The first guess is: did you surround all your visible texts with tr() ?
-
-
-
Are you sure your file is in the same folder as your executable ?
-
Include in your pro file:
@
TRANSLATIONS = HD120_en.ts
HD120_nl.ts
HD120_cn.ts
HD120_pt.ts
@
Of at least the ts files you need. That's needed for QtLinguist. Also check if your using a shadow build that your files are in the same as the executable file! Not in your project, but in your debug/release folders!! -
If that fixed it, place [SOLVED] in front of your first post!!