Most of the text to translate in an application consists of either single words or short phrases. These typically appear as window titles, menu items, tooltips, and labels to buttons, check boxes, and radio buttons.
Developers mark the phrases as translatable in the QML and C++ source code. The Qt tools provide context information for each of the phrases to help the translator understand their meaning. The developer can add comments to the phrases.
Translation files consist of all the user-visible text and Ctrl key shortcuts in an application and translations of that text.
To create translation files:
lupdate
to generate the first set of translation source (TS) files with all the user-visible text but no translations.
lupdate
to incorporate any new text added to the application.
lupdate
synchronizes the user-visible text from the application with the translations. It does not destroy any data.
lrelease
to read the TS files and produce the QM files used by the application at runtime.
For
lupdate
to work successfully, it must know which translation files to produce. Specify the files in the application's Qt project file.
当采用 CMake 构建时,使用 CMake 命令 to add targets that create or update TS files and transform them into QM files. The translation files are generated when you build the targets.
发行管理者 使用 lupdate