mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-24 23:19:29 -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
|
||||
* installed Qt directory. */
|
||||
QString qtTranslation = QLibraryInfo::location(QLibraryInfo::TranslationsPath) + "/qt_" + languageCode + ".qm";
|
||||
QTranslator *systemQtTranslator = new QTranslator(rApp);
|
||||
Q_CHECK_PTR(systemQtTranslator);
|
||||
|
||||
QString qtDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
||||
if (systemQtTranslator->load(qtDir + "/qt_" + languageCode + ".qm"))
|
||||
if (QFile::exists(qtTranslation) && systemQtTranslator->load(qtTranslation))
|
||||
QApplication::installTranslator(systemQtTranslator);
|
||||
else
|
||||
delete systemQtTranslator;
|
||||
else {
|
||||
/* 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 */
|
||||
QTranslator *retroshareTranslator = new QTranslator(rApp);
|
||||
@ -148,4 +154,3 @@ LanguageSupport::translate(const QString &languageCode)
|
||||
delete retroshareTranslator;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user