November 2014
Beginner to intermediate
264 pages
5h 32m
English
In order to supply translated strings to the tr and qsTr functions in your application, your application needs to include a QTranslator object to read the .qm files and replace the strings provided to tr and qsTr with their translated counterparts. We can do this in your main entry point function, as follows:
QApplication a(argc, argv);
QTranslator translator;
bool result = translator.load("QtLinguistExample-epo.qm");
a.installTranslator(&translator);
// Other window setup stuff goes here
return a.exec();This code allocates a QTranslator object and loads the indicated translation file into the translator before installing it into the QApplication object. In this example, we're hardcoding the language ...
Read now
Unlock full access