Load also qtbase_*.qm files.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-11-17 16:27:51 +02:00
parent cdec047f58
commit 0473db2947
2 changed files with 16 additions and 0 deletions

View File

@ -42,6 +42,7 @@ VAbstractApplication::VAbstractApplication(int &argc, char **argv)
settings(nullptr),
qtTranslator(nullptr),
qtxmlTranslator(nullptr),
qtBaseTranslator(nullptr),
appTranslator(nullptr),
pmsTranslator(nullptr),
_patternUnit(Unit::Cm),
@ -233,6 +234,14 @@ void VAbstractApplication::LoadTranslation(const QString &locale)
#endif
installTranslator(qtxmlTranslator);
qtBaseTranslator = new QTranslator(this);
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
qtBaseTranslator->load("qtbase_" + locale, translationsPath(locale));
#else
qtBaseTranslator->load("qtbase_" + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
#endif
installTranslator(qtBaseTranslator);
appTranslator = new QTranslator(this);
appTranslator->load("valentina_" + locale, translationsPath(locale));
installTranslator(appTranslator);
@ -261,6 +270,12 @@ void VAbstractApplication::ClearTranslation()
delete qtxmlTranslator;
}
if (not qtBaseTranslator.isNull())
{
removeTranslator(qtBaseTranslator);
delete qtBaseTranslator;
}
if (not appTranslator.isNull())
{
removeTranslator(appTranslator);

View File

@ -118,6 +118,7 @@ protected:
QPointer<QTranslator> qtTranslator;
QPointer<QTranslator> qtxmlTranslator;
QPointer<QTranslator> qtBaseTranslator;
QPointer<QTranslator> appTranslator;
QPointer<QTranslator> pmsTranslator;