Precautions for Qt internationalization and Localization

Source: Internet
Author: User

The QT library is very good in internationalization and localization, and it is very convenient to use the software developed by QT for the multi-language version of the software.

Generally, in programming, the qobject: TR function is used to enclose all strings. In this way, it is easy to use linguist to export English text and create translation files, then, as long as qtranslator is used in the appropriate part of the program to load the required translation file, and then qapp-> installtranslator () is called, the program naturally replaces the interface of another language.

 

However, many new users will find another problem, that is, by right-clicking in the text box, not the expected Chinese menu, but the English menu, when a file is opened or the general filedialog of the directory is selected, the information and button text are displayed in English. How can we convert English in these places into appropriate texts ???

In fact, QT has done a good job for you. There is a translation directory in the QT Directory, which contains a lot of translation files that have been prepared, as long as the corresponding translation files (*. (QM) use a new qtranslator to load the translation file and then call qapp-> installtranslator (). Then you will find that the right-click menu and general-purpose dialog box are all in Chinese.

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.