Qt to make Add. TS translation File __qt

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.