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:
thunder2 2010-11-04 18:39:24 +00:00
parent 08a69d603b
commit 37c71b4d71

View File

@ -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;
}