@@ -19,6 +19,9 @@ MainGUI::MainGUI(QWidget* parent) :
1919 ui(new Ui::MainGUI)
2020{
2121 ui->setupUi (this );
22+ // load translators
23+ cn_trans.load (" :/translations/DNX_widthGUI_zh_CN.qm" );
24+ en_trans.load (" :/translations/DNX_widthGUI_en_en.qm" );
2225 translate_en ();
2326 // connect the slider to the spinbox
2427 connect (ui->horizontalSlider , SIGNAL (sliderMoved (int )), this , SLOT (change_multiplier (int )));
@@ -31,6 +34,8 @@ MainGUI::MainGUI(QWidget* parent) :
3134 connect (ui->active_randomizer1 , SIGNAL (clicked ()), this , SLOT (activate_multiplier ()));
3235 connect (ui->active_randomizer2 , SIGNAL (clicked ()), this , SLOT (activate_multiplier ()));
3336 ui->label_7 ->setFont (QFont (customfont, 18 , 300 ));
37+
38+
3439}
3540
3641// retranslate texts
@@ -44,8 +49,6 @@ void MainGUI::retranslate_text() {
4449
4550// translate to Chinese
4651void MainGUI::translate_cn () {
47- QTranslator cn_trans;
48- cn_trans.load (" :/translations/DNX_widthGUI_zh_CN.qm" );
4952 QString tmptext = ui->loaded_file ->text ();
5053 if (!qApp->installTranslator (&cn_trans)) {
5154 QMessageBox::critical (this , " Error" , " Translation not found" );
@@ -60,8 +63,6 @@ void MainGUI::translate_cn() {
6063
6164// translate to English
6265void MainGUI::translate_en () {
63- QTranslator en_trans;
64- en_trans.load (" :/translations/DNX_widthGUI_en_en.qm" );
6566 QString tmptext = ui->loaded_file ->text ();
6667 if (!qApp->installTranslator (&en_trans)) {
6768 QMessageBox::critical (this , " Error" , " Translation not found" );
0 commit comments