Home > other >  In the QT3 how to realize the language dynamic switch
In the QT3 how to realize the language dynamic switch

Time:02-06

Based on the UI programming under the Qt3, in the main. CPP defines the QApplication app; QTranslator the translator; The translator. The load (QString (" lang_ ") + QTextCodec: : locale ()); App. InstallTranslator (& amp; The translator); When start to more local language environment variable in the system language setting, there is no question of realizing multilingual, but if we run the program, change the language of words, do not restart the system, how to do? I saw some code void MainWindow: : ch_language () {if (this - & gt; LanguageState) {this - & gt; LanguageState=CHINESE; This - & gt; The translator. The load (" test_ch "); This - & gt; POwner - & gt; InstallTranslator (& amp; (this - & gt; The translator)); } else {this - & gt; LanguageState=ENGLISH; This - & gt; The translator. The load (" test_en "); This - & gt; POwner - & gt; InstallTranslator (& amp; (this - & gt; The translator)); }} are all need to define the translator in each form, qApp? For QT3 right? Whether there is a way to in the main, CPP implementation a connect (), in the interface change language, in the main. CPP running in a slot function to change the font to load,

CodePudding user response:

Themselves to the top post, use qApp - & gt; InstallTranslator () can be solved, the original qApp this is the form of fixed some,

CodePudding user response:

Recently found on a reply is wrong,

CodePudding user response:

Then how to solve?
  • Related