diff options
author | Uli Heilmeier <uh@heilmeier.eu> | 2016-01-25 11:54:02 +0100 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-01-26 16:36:00 +0000 |
commit | 7e72253c0ec259c46546bd45fc27e1d045bfdf55 (patch) | |
tree | 2a3a9aba04102af69cd1ccbe0473e37aec3bf7ad | |
parent | 2d1b5167ce51491d097e958fee6148014168bd24 (diff) |
Qt: Detect language on Windows and load qt_xx.qm/qt_xx_XX.qm
Sytem language is reported as xx_XX (e.g. de_DE). As we're only
shipping qt_xx.qm in the Windows installer the langfile is missing.
This commits searches for qt_xx_XX.qm and qt_xx.qm files and loads it.
See also https://wiki.qt.io/How_to_create_a_multi_language_application
Furthermore it fixs commit 137dba6e66f58c0dae371e7fb98d3fdd6dc8c1f4
to load qt_xx.qm in the right way.
Change-Id: Iba9e597a44eb42b867542d1d6ffccc55f824bbe1
Reviewed-on: https://code.wireshark.org/review/13525
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r-- | ui/qt/wireshark_application.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp index 4a747cdc3f..4e1d937812 100644 --- a/ui/qt/wireshark_application.cpp +++ b/ui/qt/wireshark_application.cpp @@ -1086,12 +1086,18 @@ void WiresharkApplication::loadLanguage(const QString& newLanguage) switchTranslator(wsApp->translator, QString("wireshark_%1.qm").arg(localeLanguage), gchar_free_to_qstring(get_persconffile_path("languages", FALSE))); if (QFile::exists(QString("%1/qt_%2.qm") - .arg(get_datafile_dir()).arg(localeLanguage))) + .arg(get_datafile_dir()).arg(localeLanguage))) { switchTranslator(wsApp->translatorQt, QString("qt_%1.qm").arg(localeLanguage), QString(get_datafile_dir())); + } else if (QFile::exists(QString("%1/qt_%2.qm") + .arg(get_datafile_dir()).arg(localeLanguage.left(localeLanguage.lastIndexOf('_'))))) { + switchTranslator(wsApp->translatorQt, + QString("qt_%1.qm").arg(localeLanguage.left(localeLanguage.lastIndexOf('_'))), QString(get_datafile_dir())); + } else { switchTranslator(wsApp->translatorQt, QString("qt_%1.qm").arg(localeLanguage), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); + } } /* |