Use Qt Linguist

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, checkboxes, and radio buttons.

You mark the phrases as translatable in the QML and C++ source code. Qt localization tools provide context information for each of the phrases to help the translator understand their meaning. You can add comments to the phrases.

Translation files contain all the user-visible text and keyboard shortcuts in an application and translations of that text.

When you create a new project, you can automatically generate a translation source file (TS) for one language. To add other languages, edit the project file or go to File > New File.

To open TS files in Qt Linguist, right-click a TS file in the Projects or File System view and go to Open With > Qt Linguist in the context menu.

Use lupdate and lrelease

Use the Qt Linguist release manager tools, lupdate and lrelease, directly from Qt Creator. The lupdate tool synchronizes source code and translations. The lrelease tool creates run-time translation files for use by the released application.

Note: Running the tools from Qt Creator is supported only when using qmake as the build system. For more information about using the tools with CMake, see Qt6::LinguistTools.

By default, the project .pro file is passed to the tools as an argument. To specify other command-line arguments for the tools, go to Tools > External > Configure.

Synchronize TS files

To synchronize TS files from a translator with the application code, go to Tools > External > Linguist > Update Translations (lupdate).

Generate QM files

To generate from the TS files Qt message (QM) files that can be used by an application, go to Tools > External > Linguist > Release Translations (lrelease).

See also Add translation files, Use external tools, Internationalization with Qt, and Qt Linguist Manual.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.