Deploying translations
In previous sections, we learned how to create translation-aware applications using both Qt Widgets and QML. You don't have to ship the .ts
files with your application. To deploy translations, your release team must use the updated .qm
files and ship them with the application package. The .qm
files required for the application should be placed in a location where QTranslator
can locate them. Typically, this is done by embedding qm
files in a resource (.qrc
) file or specifying a path that contain the .qm
files relative to QCoreApplication::applicationDirPath()
. The rcc
tool is used to embed the translation files into a Qt application during the build process. It works by producing a corresponding C++ file containing specified data.
You can automate the generation of .qm
files by adding a script to your .pro
file. You do it by following these steps:
- To begin, use the language codes to declare the languages under the
LANGUAGES
variable in your Qt...