Commit acb75b0f authored by Ming Rui Zhang's avatar Ming Rui Zhang

translations: QTranslator scope change from local to application

Change-Id: I4a1966e9c453ab954ab05117757490b21e5936fb
parent fd9c2e28
......@@ -144,32 +144,32 @@ MainApplication::loadTranslations()
const auto locale_name = QLocale::system().name();
const auto locale_lang = locale_name.split('_')[0];
QTranslator qtTranslator_lang;
QTranslator qtTranslator_name;
QTranslator* qtTranslator_lang = new QTranslator(this);
QTranslator* qtTranslator_name = new QTranslator(this);
if (locale_name != locale_lang) {
if (qtTranslator_lang.load("qt_" + locale_lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
installTranslator(&qtTranslator_lang);
if (qtTranslator_lang->load("qt_" + locale_lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
installTranslator(qtTranslator_lang);
}
qtTranslator_name.load("qt_" + locale_name, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
installTranslator(&qtTranslator_name);
qtTranslator_name->load("qt_" + locale_name, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
installTranslator(qtTranslator_name);
QTranslator lrcTranslator_lang;
QTranslator lrcTranslator_name;
QTranslator* lrcTranslator_lang = new QTranslator(this);
QTranslator* lrcTranslator_name = new QTranslator(this);
if (locale_name != locale_lang) {
if (lrcTranslator_lang.load(appDir + "share/libringclient/translations/lrc_" + locale_lang))
installTranslator(&lrcTranslator_lang);
if (lrcTranslator_lang->load(appDir + "share/libringclient/translations/lrc_" + locale_lang))
installTranslator(lrcTranslator_lang);
}
if (lrcTranslator_name.load(appDir + "share/libringclient/translations/lrc_" + locale_name))
installTranslator(&lrcTranslator_name);
if (lrcTranslator_name->load(appDir + "share/libringclient/translations/lrc_" + locale_name))
installTranslator(lrcTranslator_name);
QTranslator mainTranslator_lang;
QTranslator mainTranslator_name;
QTranslator* mainTranslator_lang = new QTranslator(this);
QTranslator* mainTranslator_name = new QTranslator(this);
if (locale_name != locale_lang) {
if (mainTranslator_lang.load(appDir + "share/ring/translations/ring_client_windows_" + locale_lang))
installTranslator(&mainTranslator_lang);
if (mainTranslator_lang->load(appDir + "share/ring/translations/ring_client_windows_" + locale_lang))
installTranslator(mainTranslator_lang);
}
if (mainTranslator_name.load(appDir + "share/ring/translations/ring_client_windows_" + locale_name))
installTranslator(&mainTranslator_name);
if (mainTranslator_name->load(appDir + "share/ring/translations/ring_client_windows_" + locale_name))
installTranslator(mainTranslator_name);
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment