mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-17 13:24:15 -05:00
Loads the language file for the Qt standard dialogs from the translations dir in the application path, when the load from Qt library path failed.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3750 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
08a69d603b
commit
37c71b4d71
@ -128,14 +128,20 @@ LanguageSupport::translate(const QString &languageCode)
|
|||||||
|
|
||||||
/* Attempt to load the translations for Qt's internal widgets from their
|
/* Attempt to load the translations for Qt's internal widgets from their
|
||||||
* installed Qt directory. */
|
* installed Qt directory. */
|
||||||
|
QString qtTranslation = QLibraryInfo::location(QLibraryInfo::TranslationsPath) + "/qt_" + languageCode + ".qm";
|
||||||
QTranslator *systemQtTranslator = new QTranslator(rApp);
|
QTranslator *systemQtTranslator = new QTranslator(rApp);
|
||||||
Q_CHECK_PTR(systemQtTranslator);
|
Q_CHECK_PTR(systemQtTranslator);
|
||||||
|
|
||||||
QString qtDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
if (QFile::exists(qtTranslation) && systemQtTranslator->load(qtTranslation))
|
||||||
if (systemQtTranslator->load(qtDir + "/qt_" + languageCode + ".qm"))
|
|
||||||
QApplication::installTranslator(systemQtTranslator);
|
QApplication::installTranslator(systemQtTranslator);
|
||||||
else
|
else {
|
||||||
delete systemQtTranslator;
|
/* Attempt to load the translations for Qt's internal widgets from the translations directory in the exe dir. */
|
||||||
|
qtTranslation = QCoreApplication::applicationDirPath() + "/translations/qt_" + languageCode + ".qm";
|
||||||
|
if (QFile::exists(qtTranslation) && systemQtTranslator->load(qtTranslation))
|
||||||
|
QApplication::installTranslator(systemQtTranslator);
|
||||||
|
else
|
||||||
|
delete systemQtTranslator;
|
||||||
|
}
|
||||||
|
|
||||||
/* Install a translator for RetroShare's UI widgets */
|
/* Install a translator for RetroShare's UI widgets */
|
||||||
QTranslator *retroshareTranslator = new QTranslator(rApp);
|
QTranslator *retroshareTranslator = new QTranslator(rApp);
|
||||||
@ -148,4 +154,3 @@ LanguageSupport::translate(const QString &languageCode)
|
|||||||
delete retroshareTranslator;
|
delete retroshareTranslator;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user