Load Qt translation files from the app folder.

This commit is contained in:
Leonardo Zide 2019-03-16 16:18:10 -07:00
parent c7142d46c8
commit 8497f07dea

View file

@ -127,21 +127,23 @@ int main(int argc, char *argv[])
QTranslator QtTranslator; QTranslator QtTranslator;
if (QtTranslator.load(QLocale::system(), "qt", "_", QLibraryInfo::location(QLibraryInfo::TranslationsPath))) if (QtTranslator.load(QLocale::system(), "qt", "_", QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
{
Application.installTranslator(&QtTranslator); Application.installTranslator(&QtTranslator);
} #ifdef Q_OS_WIN
else if (QtTranslator.load(QLocale::system(), "qt", "_", qApp->applicationDirPath() + "/translations"))
Application.installTranslator(&QtTranslator);
#endif
QTranslator QtBaseTranslator; QTranslator QtBaseTranslator;
if (QtBaseTranslator.load("qtbase_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath))) if (QtBaseTranslator.load("qtbase_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
{
Application.installTranslator(&QtBaseTranslator); Application.installTranslator(&QtBaseTranslator);
} #ifdef Q_OS_WIN
else if (QtBaseTranslator.load("qtbase_" + QLocale::system().name(), qApp->applicationDirPath() + "/translations"))
Application.installTranslator(&QtBaseTranslator);
#endif
QTranslator Translator; QTranslator Translator;
if (Translator.load("leocad_" + QLocale::system().name(), ":/resources")) if (Translator.load("leocad_" + QLocale::system().name(), ":/resources"))
{
Application.installTranslator(&Translator); Application.installTranslator(&Translator);
}
qRegisterMetaTypeStreamOperators<QList<int> >("QList<int>"); qRegisterMetaTypeStreamOperators<QList<int> >("QList<int>");