Qt: Load qt_XX.qm to translate Qt Strings

The Windows installation includes the Qt translations files qt_XX.qm
in the installation directory (e.g. C:\Program Files\Wireshark\).

However we've tried to load the files only from the
QLibraryInfo::TranslationsPath (C:\Qt\5.3\msvc2013_64_opengl\translations\).
This path is missing in a normal Windows environment.

Therefore strings like "Ctrl" haven't been translated.

Change-Id: I45bc873fdd95fd0ab5c79e70d9ff062274f899fe
Reviewed-on: https://code.wireshark.org/review/13485
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:
Uli Heilmeier 2016-01-22 20:36:15 +01:00 committed by Michael Mann
parent 720f57d000
commit 88cd6552ea
1 changed files with 4 additions and 0 deletions

View File

@ -1085,6 +1085,10 @@ void WiresharkApplication::loadLanguage(const QString& newLanguage)
.arg(gchar_free_to_qstring(get_persconffile_path("languages", FALSE))).arg(localeLanguage)))
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)))
switchTranslator(wsApp->translatorQt,
QString("qt_%1.qm").arg(localeLanguage), QString(get_datafile_dir()));
switchTranslator(wsApp->translatorQt,
QString("qt_%1.qm").arg(localeLanguage),
QLibraryInfo::location(QLibraryInfo::TranslationsPath));