Qt TS

Qt TS localization for Qt applications.

Translate the .ts files that lupdate writes, reuse earlier translations, check placeholders, and write translated .ts files for lrelease. Your Qt project keeps extraction, the build, and runtime loading.

Translated in Qt Linguist? See how migration works

Qt TS localization: Professional and higher

Your source TS app.ts Lingobit Localizer Project SourceGerman New Order Neue Bestellung Customer: Kunde: Quantity: Menge: Each string, translated in the project You get app.ts app_de.ts app_fr.ts app_ja.ts A translated file for each language; lrelease builds .qm Your source TS app.ts Translate in Lingobit Project SourceGerman New Order Neue Bestellung Customer: Kunde: Quantity: Menge: You get app.ts source app_de.ts app_fr.ts app_ja.ts
Input
.ts files written by lupdate
Output
Translated .ts files, such as app_de.ts
Runtime
.qm files built by lrelease, loaded by QTranslator
Preview
None: strings are translated in the table
On this page

Tutorial

Localize Qt .ts files with Lingobit, step by step.

Four steps from the .ts files lupdate writes to translated files for lrelease.

Your source TS app.ts Project DE FR JA LOC MyApp.loc app.tsTS New Order Customer: reports.tsTS Export %1 pages to %2. Report Format Qt TS TS Your source TS app.ts Project DE FR JA LOC MyApp.loc app.tsTS New Order Customer: reports.tsTS Export %1 pages to %2. Report Format Qt TS TS
  1. Your source TS app.ts Project DE FR JA LOC MyApp.loc app.tsTS New Order Customer: reports.tsTS Export %1 pages to %2. Report Format Qt TS TS Your source TS app.ts Project DE FR JA LOC MyApp.loc app.tsTS New Order Customer: reports.tsTS Export %1 pages to %2. Report Format Qt TS TS

Translation Hints match Source Order {0} has been saved. Order %1 has been saved. Order %s has been saved. Current Bestellung {0} wurde gesichert. Bestellung %1 wurde gesichert. Bestellung %s wurde gesichert. DeepL Bestellung {0} wurde gespeichert. Bestellung %1 wurde gespeichert. Bestellung %s wurde gespeichert. 86% Google Translate Bestellung wurde gespeichert. Missing {0} Missing %1 Missing %s 71% ! Azure Translator Die Bestellung {0} wurde gespeichert. Die Bestellung %1 wurde gespeichert. Die Bestellung %s wurde gespeichert. 79% Translation memory Bestellung {0} gespeichert. Bestellung %1 gespeichert. Bestellung %s gespeichert. 68% Translation Hints match Source Order {0} has been saved. Order %1 has been saved. Order %s has been saved. Current Bestellung {0} wurde gesichert. Bestellung %1 wurde gesichert. Bestellung %s wurde gesichert. DeepL 86% Bestellung {0} wurde gespeichert. Bestellung %1 wurde gespeichert. Bestellung %s wurde gespeichert. Google Translate 71% ! Bestellung wurde gespeichert. Missing {0} Missing %1 Missing %s Azure Translator 79% Die Bestellung {0} wurde gespeichert. Die Bestellung %1 wurde gespeichert. Die Bestellung %s wurde gespeichert. Translation memory 68% Bestellung {0} gespeichert. Bestellung %1 gespeichert. Bestellung %s gespeichert.
Your files TMX XLIFF CSV Open file Ship today 100% Print preview Notify the customer. 95% Microsoft terms Cancel Folder Quantity only what matches the project Project Translation memory Ship today Noch heute versenden Notify the customer. Kunde benachrichtigen. Terminology Cancel Abbrechen Quantity Menge Your files TMX XLIFF CSV Open file Ship today100% Print preview Notify the customer.95% Microsoft terms CancelFolderQuantity only what matches the project Project Translation memory Ship today Noch heute versenden Notify the customer. Kunde benachrichtigen. Terminology Cancel→Abbrechen Quantity→Menge
ProjectDEFRJAMyApp.locapp.tsNew Orderreports.ts PrepareTranslationTaskImportTranslationResults TranslatorDENew OrderNeue BestellungCustomer:Kunde:CreateErstellenSourceGermanNew OrderNeue BestellungCustomer:Kunde:Quantity:Menge:Validation on save Or their CAT toolXLIFF 1.2for the tool the translatoralready uses ProjectDEFRJAMyApp.locapp.tsNew Orderreports.ts PrepareTranslation Task TranslatorDENew OrderNeue BestellungCustomer:Kunde:CreateErstellenSourceGermanNew OrderNeue BestellungCustomer:Kunde:Quantity:Menge:Validation on save Or their CAT toolXLIFF 1.2for the tool the translatoralready uses ImportResults
  1. Translation Hints match Source Order {0} has been saved. Order %1 has been saved. Order %s has been saved. Current Bestellung {0} wurde gesichert. Bestellung %1 wurde gesichert. Bestellung %s wurde gesichert. DeepL Bestellung {0} wurde gespeichert. Bestellung %1 wurde gespeichert. Bestellung %s wurde gespeichert. 86% Google Translate Bestellung wurde gespeichert. Missing {0} Missing %1 Missing %s 71% ! Azure Translator Die Bestellung {0} wurde gespeichert. Die Bestellung %1 wurde gespeichert. Die Bestellung %s wurde gespeichert. 79% Translation memory Bestellung {0} gespeichert. Bestellung %1 gespeichert. Bestellung %s gespeichert. 68% Translation Hints match Source Order {0} has been saved. Order %1 has been saved. Order %s has been saved. Current Bestellung {0} wurde gesichert. Bestellung %1 wurde gesichert. Bestellung %s wurde gesichert. DeepL 86% Bestellung {0} wurde gespeichert. Bestellung %1 wurde gespeichert. Bestellung %s wurde gespeichert. Google Translate 71% ! Bestellung wurde gespeichert. Missing {0} Missing %1 Missing %s Azure Translator 79% Die Bestellung {0} wurde gespeichert. Die Bestellung %1 wurde gespeichert. Die Bestellung %s wurde gespeichert. Translation memory 68% Bestellung {0} gespeichert. Bestellung %1 gespeichert. Bestellung %s gespeichert.
  2. Your files TMX XLIFF CSV Open file Ship today 100% Print preview Notify the customer. 95% Microsoft terms Cancel Folder Quantity only what matches the project Project Translation memory Ship today Noch heute versenden Notify the customer. Kunde benachrichtigen. Terminology Cancel Abbrechen Quantity Menge Your files TMX XLIFF CSV Open file Ship today100% Print preview Notify the customer.95% Microsoft terms CancelFolderQuantity only what matches the project Project Translation memory Ship today Noch heute versenden Notify the customer. Kunde benachrichtigen. Terminology Cancel→Abbrechen Quantity→Menge
  3. ProjectDEFRJAMyApp.locapp.tsNew Orderreports.ts PrepareTranslationTaskImportTranslationResults TranslatorDENew OrderNeue BestellungCustomer:Kunde:CreateErstellenSourceGermanNew OrderNeue BestellungCustomer:Kunde:Quantity:Menge:Validation on save Or their CAT toolXLIFF 1.2for the tool the translatoralready uses ProjectDEFRJAMyApp.locapp.tsNew Orderreports.ts PrepareTranslation Task TranslatorDENew OrderNeue BestellungCustomer:Kunde:CreateErstellenSourceGermanNew OrderNeue BestellungCustomer:Kunde:Quantity:Menge:Validation on save Or their CAT toolXLIFF 1.2for the tool the translatoralready uses ImportResults

Output · Validation Inconsistent format string MainWindow · Export Fixed Resource MainWindow · Export Source Export {0} pages to {1}. Export %d pages to %s. Export <b>all</b> pages. Export %1 pages to %2. German {0} Seiten nach {2} exportieren. %d Seiten nach %d exportieren. <b>Alle</i> Seiten exportieren. %1 Seiten nach %3 exportieren. {0} Seiten nach {1} exportieren. %d Seiten nach %s exportieren. <b>Alle</b> Seiten exportieren. %1 Seiten nach %2 exportieren. Output · Validation Inconsistent format string MainWindow · Export Fixed MainWindow · Export Source Export {0} pages to {1}. Export %d pages to %s. Export <b>all</b> pages. Export %1 pages to %2. German {0} Seiten nach {2} exportieren. %d Seiten nach %d exportieren. <b>Alle</i> Seiten exportieren. %1 Seiten nach %3 exportieren. {0} Seiten nach {1} exportieren. %d Seiten nach %s exportieren. <b>Alle</b> Seiten exportieren. %1 Seiten nach %2 exportieren.
  1. Output · Validation Inconsistent format string MainWindow · Export Fixed Resource MainWindow · Export Source Export {0} pages to {1}. Export %d pages to %s. Export <b>all</b> pages. Export %1 pages to %2. German {0} Seiten nach {2} exportieren. %d Seiten nach %d exportieren. <b>Alle</i> Seiten exportieren. %1 Seiten nach %3 exportieren. {0} Seiten nach {1} exportieren. %d Seiten nach %s exportieren. <b>Alle</b> Seiten exportieren. %1 Seiten nach %2 exportieren. Output · Validation Inconsistent format string MainWindow · Export Fixed MainWindow · Export Source Export {0} pages to {1}. Export %d pages to %s. Export <b>all</b> pages. Export %1 pages to %2. German {0} Seiten nach {2} exportieren. %d Seiten nach %d exportieren. <b>Alle</i> Seiten exportieren. %1 Seiten nach %3 exportieren. {0} Seiten nach {1} exportieren. %d Seiten nach %s exportieren. <b>Alle</b> Seiten exportieren. %1 Seiten nach %2 exportieren.

Project Open Öffnen Save Speichern Print Drucken Export Exportieren Removed Help Hilfe Scan for Changes New build Open Öffnen Save Speichern Print all Updated Help Hilfe Share New Project Öffnen Speichern Drucken Exportieren Hilfe Removed Scan for Changes New build Open Öffnen Save Speichern Print all Updated Help Hilfe Share New
  1. Project Open Öffnen Save Speichern Print Drucken Export Exportieren Removed Help Hilfe Scan for Changes New build Open Öffnen Save Speichern Print all Updated Help Hilfe Share New Project Öffnen Speichern Drucken Exportieren Hilfe Removed Scan for Changes New build Open Öffnen Save Speichern Print all Updated Help Hilfe Share New

lupdate extracts, Lingobit translates, lrelease builds.

Your code marks text with tr() or qsTr(), and lupdate collects it into .ts files. Lingobit translates those files and writes one translated .ts file for each language. lrelease compiles them into .qm files, which your application loads at runtime.

Your Qt projectLingobit lupdateTSapp.tstranslate, checkDEapp_de.tslrelease lupdate extractsLingobit translates the TS filelrelease builds .qm Your Qt project lupdateTSapp.tsLingobittranslate, checkDEapp_de.tslrelease

Lingobit does

  • Translates the strings of your .ts files, with their context and translator comments.
  • Reuses earlier translations and the translation memory.
  • Checks placeholders such as %1, empty and too long translations, and more.
  • Writes a translated .ts file for each language.

Your Qt project keeps

  • Marking strings with tr() and qsTr(), and running lupdate.
  • Compiling .ts into .qm with lrelease or your CMake or qmake target.
  • Loading the translation at runtime and the language switch.
  • Qt Designer, QML, and the final test in the running application.

Reference

At startup, QTranslator picks the .qm file by its name.

Lingobit writes app_de.ts, lrelease turns it into app_de.qm, and your code asks QTranslator to load a file for the user's language. For German (Germany) it tries app_de_DE.qm, then app_de.qm.

WindowsGerman (Germany)QLocale: de_DE QTranslator looks forapp_de_DE.qmnot shippedapp_de.qmloaded Your application Neue BestellungKunde:Report Without a translation, a string shows its source text. WindowsGerman (Germany)QLocale: de_DE QTranslator looks forapp_de_DE.qmnot shippedapp_de.qmloaded Neue BestellungKunde:Report Without a translation, a string shows its source text.
  • One file serves a language. app_de.qm serves German in Germany, Austria, and Switzerland; add app_de_CH.qm only when Swiss German text differs.
  • A missing translation shows the source text. A string that is new or still untranslated appears in the source language; it does not break the application.
QTranslator translator;
if (translator.load(QLocale(), "app", "_", ":/i18n"))
    app.installTranslator(&translator);

Choose the language in your app.

Load the translation before the first window is created. To let users pick the language, keep their choice and use it instead of the system language:

  1. List the languages you ship from the .qm files in your resources or folder.
  2. Read the saved choice or a command-line switch; otherwise use QLocale::system().
  3. Load and install the translator before MainWindow is created.
  4. Switch while running by installing another translator and calling retranslateUi on LanguageChange, or restart.
QSettings settings;
const QString lang = settings.value("language", QLocale::system().name()).toString();

QTranslator translator;
if (translator.load("app_" + lang, ":/i18n"))
    app.installTranslator(&translator);

MainWindow window;
window.show();

Context and comments travel with each string.

Context

lupdate puts each string in a context, usually the class name. Lingobit keeps it with the string and matches translations by context and source text when lupdate refreshes the file. Rename a class, and its strings arrive as new.

Translator comments

A comment written with //: above a tr() call reaches translators with the string. Use it for short or ambiguous text, such as a button label or a unit.

//: Button that sends the order; keep it short
auto send = new QPushButton(tr("Send"), this);

Do and don't.

Do

  • Run lupdate before every handoff, and add the refreshed .ts files.
  • Use %1, %2 with QString::arg, so translators can change the order.
  • Add //: comments to short and ambiguous strings.
  • Keep .ts names and language codes in line with your loading code.
  • Ship Qt's own translations, such as qtbase_de.qm, for the standard dialogs.

Don't

  • Build sentences in code from translated pieces.
  • Edit the translated .ts files by hand: the next Create overwrites them.
  • Rename classes after translation has started without a reason.
  • Send C++, QML, or .ui files to translators.
  • Install the translator after the windows are created.

Troubleshooting.

Symptoms, causes, and what to do
SymptomLikely causeWhat to do
The application stays in EnglishNo .qm file was built or shipped for the language, its name does not match the loading code, or the translator was installed after the windows were createdRun lrelease on the translated .ts files, check the file name and folder, and install the translator first
Some strings stay in EnglishThey are not marked with tr() or qsTr(), or lupdate has not run since they were addedMark them, run lupdate, and run Scan for Changes in Lingobit
Translations are New again after lupdateThe source text changed, or the context changed because a class was renamedKeep contexts stable; earlier translations stay in the translation memory and come back as suggestions
Standard Qt dialogs stay in EnglishQt's own translations are not loadedLoad qtbase_de.qm from the Qt translations folder as well
German text is cut off in the application.ts files have no preview, so long text shows only in the running applicationSet a maximum length for the strings in Lingobit; Validation reports translations that exceed it. Check the screens in the running application
The application crashes with one languageA translation breaks a placeholder that arg() expectsRun Validation: it reports translations whose placeholders do not match the source

The Qt sample.

Localizer installs a Qt sample with its project, so you can try the steps above without your own application.

  • Qt_Localization.ts, written by lupdate from a qmake project, and the Lingobit project Qt Localization.loc.
  • Create Localized Files writes the translated .ts files.
  • compile_ts.cmd runs lrelease on them and makes the .qm files.
  • qt_localization.exe es starts the Spanish version; without an argument the sample uses the Windows language.

More about Qt localization.

Qt .ui files and QML

Qt Designer .ui files and QML files can contain user-facing strings, but the handoff to Lingobit is still the generated .ts files: lupdate extracts the strings from .ui, QML, C++, and the other configured files, translators work with the .ts files, and developers compile them into .qm and check the UI in the application.

Qt Designer layout changes, QML component behavior, the Qt resource system, and CMake or qmake target configuration stay in the Qt project.

Clear boundaries
  • Lingobit translates Qt .ts files; it does not localize compiled Qt applications directly.
  • It does not replace lupdate, lrelease, or Qt Designer, and it does not compile .ts files into .qm files.
  • Runtime language loading, fallback, and packaging the .qm files stay with the application.