forked from osmocom/wireshark
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>
This commit is contained in:
parent
2d1b5167ce
commit
7e72253c0e
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue