See the next chapter for additional information regarding the language. The file’s name is composed of the application name followed by the language and, finally, the. SOURCES: Python source files containing the texts to translate.The developer has to use a specific file (.pro) to configure how the translation files will be generated: The translation files (.ts) must be either created if not existing or updated if a text has been added, modified, or removed. Then, the developer just has to call the tr() function for each text to be translated: Translation Files (.ts)
To make the code more readable, I recommend you to implement the following tr() function:
Step 7 (optional): Convert the translation binary files into a python resources module.Step 6: Convert translation files into binary files.
Please download the source from the below link:Īlong with QTranslator, Qt provides QLocale which can be used to handle currencies, date and time representations.Depending on the type and the size of a project, the developer and the translator can be one unique person.įor the creation of the application’s GUI part, there are two options for the developer:
Create a widget project with name translationExample and save to disk.User should have basic understanding of multilingual applications.We need to translate the following strings: Let’s try to make the following user interface multi-lingual. The QTranslate load function loads a specific language resource for the application. qm files could be packaged with the application as external or internal resources. The following diagram details the steps for developers to generate. qm files for each language that they plan to support. Qt provides QTranslator for developers to switch between language choices.
This article provides a detailed treatment on how to use these tools to build a multi-lingual dialog box. The tool chain includes tools starting from Qt Creator, lupdate, lrelease. Qt provides a linguist tool chain for building and supporting applications for various regions of the world. This paper describes how to build a multi-lingual application using Qt framework.