[Localization] Qt Framework translations files in a .qrc file
Eric Barral
e.barral at bia.fr
Tue May 9 18:19:40 CEST 2017
Hello everyone,
I have stumbled on a little problem while translating my application, but I might doing it wrong, as I prefer to embark the .qm files in a .qrc file.
I first done it with my .qm files (holding translated strings from my source code), and it worked.
Then I noticed that I needed to add the translations files from the Qt framework itself (translating for example Yes and No buttons text from a simple MessageDialog).
First I added qt_[locale].qm file (from the Qt translations folder) to the qrc, and called it to build a QTranslator object but it didn't work.
Then I realized that this was a "top level" file only contains references to other "low level" .qm files lying in the same folder (qtbase, qtscript, qtquick1, qtmultimedia, qtxmlpatterns).
So I added those files in the .qrc, alongside the top level one, still using the qt_[locale].qm file to build a QTranslator object, but it didn't work.
Finally I used specifically the "low level" .qm files to build a QTranslator object and it worked (i.e. qtbase_[locale].qm)!
Is there a more convenient way to achieve such task?
Best Regards,
Eric BARRAL.
More information about the Localization
mailing list