Fix translation loading

Explanation see here:
https://www.kdab.com/fixing-a-common-antipattern-when-loading-translations-in-qt/
This commit is contained in:
Nicolas Werner 2020-07-10 03:17:23 +02:00
parent 3421728898
commit da2f80df60

View file

@ -173,11 +173,12 @@ main(int argc, char *argv[])
QString lang = QLocale::system().name();
QTranslator qtTranslator;
qtTranslator.load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
qtTranslator.load(
QLocale(), "qt", "_", QLibraryInfo::location(QLibraryInfo::TranslationsPath));
app.installTranslator(&qtTranslator);
QTranslator appTranslator;
appTranslator.load("nheko_" + lang, ":/translations");
appTranslator.load(QLocale(), "nheko", "_", ":/translations");
app.installTranslator(&appTranslator);
MainWindow w;