Hi all !

I'm trying to translate my application. All is ok with the files which come from .ui . But with aller QMessageBox (just an exemple), I have a problem :

here's the main.cpp :
Qt Code:
  1. int main(int argc, char **argv)
  2. {
  3. ...
  4. else if(argc == 1)
  5. {
  6. // the translation is loaded in the contructor of ui_murefImpl (see below this code)
  7. ui_murefImpl window(0, &app);
  8. window.show();
  9.  
  10. // I'm doing this because I saw this in the ui.h file (and tr() && QApplication::translate() are too ineffective
  11. QPushButton hello(QApplication::translate("MainWindow", "Music", 0, QApplication::UnicodeUTF8));
  12. hello.resize(100, 30);
  13. hello.show();
  14.  
  15. return app.exec();
  16. }
  17. ....
  18. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. ui_murefImpl::ui_murefImpl(QWidget *parent, QApplication *myApp) : QMainWindow(parent)
  2. {
  3. configure(myApp);
  4. }
  5.  
  6. void ui_murefImpl::configure(QApplication *myApp)
  7. {
  8. // all that is correct because the ui is translated !
  9. QTranslator translator;
  10. QString locale = QLocale::system().name();
  11. translator.load(QString("MuRef_") + locale);
  12. myApp->installTranslator(&translator);
  13. ...
  14. ui.setupUi(this);
  15. ...
  16. }
To copy to clipboard, switch view to plain text mode 

The problem is that (of course) the text in the button is not translated (but I do correctly all the other manipulations : lupdate, qtlinguist (made changements, saved), lrelease and launching the program).


Thanks for reading !

P.S.: I'm doing tests on a "hello button" because I don't want to recompile each time the whole app. But if it work on a QPushButton, it will still work with a QMessageBox...