For details, "you must install the translator before the interface is displayed. Otherwise, the translated interface cannot be displayed"

Source: Internet
Author: User

Recently, in order to implement the multi-language interface switching using the software designed by QT, some materials have been collected and tested, and some problems have been found on my platform. To sum up, for future use.

Bytes --------------------------------------------------------------------------------------------------------------------
I recently saw a blog post on installing a translator on the Internet, which roughly means that the translator must be installed before the interface is displayed. Otherwise, the translated interface cannot be displayed.

Reference part of the Code: Signature :-----------------------------------------------------------------------------------------------------The following order is correct.
Qtranslator Translator (0 );
Translator. Load ("French. QM ",".");
App. installtranslator (& translator );
Mywidget m;
App. setmainwidget (& M );
M. Show ();
The following sequence is incorrect. The translator is installed only after the interface is displayed.
Mywidget m;
App. setmainwidget (& M );
M. Show ();
Qtranslator Translator (0 );
Translator. ("myexec_zh.qm", "."); // match the name of the Qm file.
App. installtranslator (& translator );
The error is that the translator is installed only after the interface is displayed, and the translator cannot be translated. You must install the translator before the interface is displayed. It is best to install the translator immediately after the app.

Bytes --------------------------------------------------------------------------------------------------------------------

 I tried it on my own machine and found that this conclusion is not applicable on my platform (qt3.1.1). You do not have to install a translator in front of the interface.

Related Article

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.