From 62a9b9c2b1f063313e61b861620304dc0c5d6e27 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Fri, 4 Feb 2022 15:27:53 +0600 Subject: [PATCH] Load Qt's translations from application directory --- src/qt/qt_progsettings.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/qt/qt_progsettings.cpp b/src/qt/qt_progsettings.cpp index 47414a2a5..1716c4cda 100644 --- a/src/qt/qt_progsettings.cpp +++ b/src/qt/qt_progsettings.cpp @@ -149,7 +149,8 @@ void ProgSettings::loadTranslators(QObject *parent) { qDebug() << "Translations loaded.\n"; QCoreApplication::installTranslator(translator); - qtTranslator->load(QLatin1String("qtbase_") + localetofilename.replace('-', '_'), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); + if (!qtTranslator->load(QLatin1String("qtbase_") + localetofilename.replace('-', '_'), QLibraryInfo::location(QLibraryInfo::TranslationsPath))) + qtTranslator->load(QLatin1String("qtbase_") + localetofilename.replace('-', '_'), QApplication::applicationDirPath() + "/./translations/"); if (QApplication::installTranslator(qtTranslator)) { qDebug() << "Qt translations loaded." << "\n"; @@ -162,7 +163,8 @@ void ProgSettings::loadTranslators(QObject *parent) { translator->load(QLatin1String("86box_") + lcid_langcode[lang_id].first, QLatin1String(":/")); QCoreApplication::installTranslator(translator); - qtTranslator->load(QLatin1String("qtbase_") + QString(lcid_langcode[lang_id].first).replace('-', '_'), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); + if (!qtTranslator->load(QLatin1String("qtbase_") + QString(lcid_langcode[lang_id].first).replace('-', '_'), QLibraryInfo::location(QLibraryInfo::TranslationsPath))) + qtTranslator->load(QLatin1String("qtbase_") + QString(lcid_langcode[lang_id].first).replace('-', '_'), QApplication::applicationDirPath() + "/./translations/"); QCoreApplication::installTranslator(qtTranslator); } }