QT Internationalization of the use of Qtranslator general use of QT design software, more use of the default English (including menus, buttons, dialog boxes, etc.) display, and then use the international functional class according to specific occasions, the same software to achieve the functions of different languages. Class Qtranslator is a class that implements internationalization and is easy to use. A simple and outrageous example:
Qapplication A (argc, argv);
Qtranslator *translator = new Qtranslator;
Translator->load ("./testhello.qm");
A.installtranslator (translator);
Of course, a software generally support a variety of languages, and hope that this set of language in the next landing is still the language of the setting, this will require a long-term maintenance of software settings information, such as the registry. An example of multiple languages:
Qapplication app (argc, argv);
Qsettings settings;
QString language = Settings.value ("language"). toString ();
Qtranslator Qttranslator;
QString translationfile = ":/translations/qt_" + language + ". QM";
Qttranslator.load (translationfile);
App.installtranslator (&qttranslator);