Creating translation files | Qt Linguist Manual

- Qt 6.5
- Qt Linguist Manual
- Creating translation files
- Qt 6.5.1 Reference Documentation

Release managers ◦ Using lupdate

# Creating translation files

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:

1. Run `lupdate` to generate the first set of translation source (TS) files with all the user-visible text but no translations.
2. Give the TS files to translators who add translations using Qt Linguist. Qt Linguist indicates changed and deleted source text.
3. Run `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.
4. Run `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.

When building with CMake, you use CMake commands 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.

Release managers ◦ Using lupdate