From 37c71b4d71fc5c9aae2fba1b47ba168dcb02d306 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Thu, 4 Nov 2010 18:39:24 +0000 Subject: [PATCH] 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 --- retroshare-gui/src/lang/languagesupport.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/retroshare-gui/src/lang/languagesupport.cpp b/retroshare-gui/src/lang/languagesupport.cpp index 89ac7dde4..4e5d2fe5c 100644 --- a/retroshare-gui/src/lang/languagesupport.cpp +++ b/retroshare-gui/src/lang/languagesupport.cpp @@ -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; } -