LKBEN11531: Howto update language files in a Qt Application
Symptom
You programmed a multi language program and need to update the language files
Cause
When you make changes in your code, you need to update the language afterwards
Solution
To regenerate the language files from the commandline you use the lupdate command. The commands stand for "language update". It will parse your pro (= project file) and go through all the code and extract the string from the dialogs and from the tr function.
Sometimes you need to add the pro file.
lupdate yourproject.pro
Here an example of the translate function in code. If some of the strings are not translated, you need to place this string into the translate function.
//The string Ready will be in the translation file
myUi->statusbar->showMessage(tr("Ready"),0);
//The string Starting... will not be in the translation file
myUi->statusbar->showMessage("Starting...",0);
Now that the translation files are updated, you still need to translate the texts. This is done with the "Qt Linguist" tool.
This tool will guide you through the translation.
Have fun.
Disclaimer:
The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!About the Author
Author:
- Keskon GmbH & Co. KGWim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.
Latest update: 20/03/2022 | Comment: