qt to make Add. TS translation Files
QT can be used in its own tools to translate the interface language to achieve the effect of supporting the language, which is a useful tool to develop users across the language area is a special practical function.
Here's how to make and use QT translation files:
First, generate. TS translation files (. ts is a readable translation file, using simple XML format) to start QT's command-line tool: Start-> program-> qt4.7.0-> qt4.7.0 commond; In the command Line window, go to the engineering directory Use the Edit tool to open the. Pro file and add translations + = Yourproject_zh.ts at the end
The name on the right side of the equal sign can be taken by itself, such as the suffix _zh in Chinese, the _en in English, easy to identify
4. Then go back to the QT Command Line window and execute
Lupdate–verbose Yourproject.pro//generate the corresponding. ts file
Ii. editing. ts files
1) Connect, execute in the command line window
Linguist//Start linguist language translation tool, you can translate the corresponding visible strings
(Start: Command line or Start menu available)
2 Open: The file--->open in the tool interface, you can open the desired. TS
File
3 translation: The middle of the interface, two lines: the first line: Source Text second line: ... Translation,
In the two line of the corresponding translation can be translated, after the translation of a click "OK Next" button.
can be saved.
Iii. QM file (. QM is a binary machine language that is converted from. ts)
Lrelease–verbose Spreadsheet.pro///translate the translated files to generate. qm Files
Iv. when modifying or adding new interface components
Just start with the lupdate-verbose step and you can do it.
The resulting. qm file is then placed in the correct directory to achieve the translation effect.
If you have Visual Studio with Plug-ins installed, you can also right-click the solution to implement the same functionality as the Lupdate and Lrelease commands.