diff --git a/bin/locale/qt_ar.qm b/bin/locale/qt_ar.qm deleted file mode 100644 index 55f2293ea..000000000 Binary files a/bin/locale/qt_ar.qm and /dev/null differ diff --git a/bin/locale/qt_cs.qm b/bin/locale/qt_cs.qm deleted file mode 100644 index 8df1e98d8..000000000 Binary files a/bin/locale/qt_cs.qm and /dev/null differ diff --git a/bin/locale/qt_da.qm b/bin/locale/qt_da.qm deleted file mode 100644 index 9366c63c0..000000000 Binary files a/bin/locale/qt_da.qm and /dev/null differ diff --git a/bin/locale/qt_de.qm b/bin/locale/qt_de.qm deleted file mode 100644 index 113bbcc39..000000000 Binary files a/bin/locale/qt_de.qm and /dev/null differ diff --git a/bin/locale/qt_es.qm b/bin/locale/qt_es.qm deleted file mode 100644 index 519116090..000000000 Binary files a/bin/locale/qt_es.qm and /dev/null differ diff --git a/bin/locale/qt_eu.qm b/bin/locale/qt_eu.qm deleted file mode 100644 index 4c00b6a7b..000000000 Binary files a/bin/locale/qt_eu.qm and /dev/null differ diff --git a/bin/locale/qt_fa.qm b/bin/locale/qt_fa.qm deleted file mode 100644 index f2272885a..000000000 Binary files a/bin/locale/qt_fa.qm and /dev/null differ diff --git a/bin/locale/qt_fr.qm b/bin/locale/qt_fr.qm deleted file mode 100644 index a81ddc71f..000000000 Binary files a/bin/locale/qt_fr.qm and /dev/null differ diff --git a/bin/locale/qt_gl.qm b/bin/locale/qt_gl.qm deleted file mode 100644 index c2eca9891..000000000 Binary files a/bin/locale/qt_gl.qm and /dev/null differ diff --git a/bin/locale/qt_he.qm b/bin/locale/qt_he.qm deleted file mode 100644 index f9aa233c8..000000000 Binary files a/bin/locale/qt_he.qm and /dev/null differ diff --git a/bin/locale/qt_hu.qm b/bin/locale/qt_hu.qm deleted file mode 100644 index fe78c348d..000000000 Binary files a/bin/locale/qt_hu.qm and /dev/null differ diff --git a/bin/locale/qt_it.qm b/bin/locale/qt_it.qm deleted file mode 100644 index 00b3f4a4d..000000000 Binary files a/bin/locale/qt_it.qm and /dev/null differ diff --git a/bin/locale/qt_ja.qm b/bin/locale/qt_ja.qm deleted file mode 100644 index 9b4f5378b..000000000 Binary files a/bin/locale/qt_ja.qm and /dev/null differ diff --git a/bin/locale/qt_pl.qm b/bin/locale/qt_pl.qm deleted file mode 100644 index 07bd88189..000000000 Binary files a/bin/locale/qt_pl.qm and /dev/null differ diff --git a/bin/locale/qt_pt.qm b/bin/locale/qt_pt.qm deleted file mode 100644 index 9494f6865..000000000 Binary files a/bin/locale/qt_pt.qm and /dev/null differ diff --git a/bin/locale/qt_ru.qm b/bin/locale/qt_ru.qm deleted file mode 100644 index 1ee686f4a..000000000 Binary files a/bin/locale/qt_ru.qm and /dev/null differ diff --git a/bin/locale/qt_sk.qm b/bin/locale/qt_sk.qm deleted file mode 100644 index 5b3b48474..000000000 Binary files a/bin/locale/qt_sk.qm and /dev/null differ diff --git a/bin/locale/qt_sv.qm b/bin/locale/qt_sv.qm deleted file mode 100644 index f3556bcaa..000000000 Binary files a/bin/locale/qt_sv.qm and /dev/null differ diff --git a/bin/locale/qt_uk.qm b/bin/locale/qt_uk.qm deleted file mode 100644 index 596afb9cb..000000000 Binary files a/bin/locale/qt_uk.qm and /dev/null differ diff --git a/bin/locale/qt_zh_CN.qm b/bin/locale/qt_zh_CN.qm deleted file mode 100644 index 623b8e33a..000000000 Binary files a/bin/locale/qt_zh_CN.qm and /dev/null differ diff --git a/bin/locale/qt_zh_TW.qm b/bin/locale/qt_zh_TW.qm deleted file mode 100644 index a9a25b204..000000000 Binary files a/bin/locale/qt_zh_TW.qm and /dev/null differ diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index ea1691500..2582a4ed7 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -932,12 +933,15 @@ void MainApplication::loadTheme(const QString &name) void MainApplication::translateApp() { Settings settings; - QString file = settings.value("Language/language", QLocale::system().name()).toString(); + QString file = settings.value(QSL("Language/language"), QLocale::system().name()).toString(); - if (!file.isEmpty() && !file.endsWith(QLatin1String(".qm"))) { - file.append(".qm"); + if (!file.isEmpty() && !file.endsWith(QL1S(".qm"))) { + file.append(QL1S(".qm")); } + // Either we load default language (with empty file), or we attempt to load xx.qm (xx_yy.qm) + Q_ASSERT(file.isEmpty() || file.size() >= 5); + QString translationPath = DataPaths::path(DataPaths::Translations); if (!file.isEmpty()) { @@ -945,11 +949,11 @@ void MainApplication::translateApp() foreach (const QString &path, translationsPaths) { // If "xx_yy" translation doesn't exists, try to use "xx*" translation - // It can only happen when Language is chosen from system locale + // It can only happen when language is chosen from system locale if (!QFile(QString("%1/%2").arg(path, file)).exists()) { QDir dir(path); - QString lang = file.left(2) + QLatin1String("*.qm"); + QString lang = file.left(2) + QL1S("*.qm"); const QStringList translations = dir.entryList(QStringList(lang)); @@ -964,11 +968,18 @@ void MainApplication::translateApp() } } + // Load application translation QTranslator* app = new QTranslator(this); app->load(file, translationPath); + // Load Qt translation (first try to load from Qt path) QTranslator* sys = new QTranslator(this); - sys->load("qt_" + file, translationPath); + sys->load(QL1S("qt_") + file, QLibraryInfo::location(QLibraryInfo::TranslationsPath)); + + // If there is no translation in Qt path for specified language, try to load it from our path + if (sys->isEmpty()) { + sys->load(QL1S("qt_") + file, translationPath); + } m_languageFile = file;