Added and modified patch from waseihou

Added support for external translation files for the main application and the plugins LinksCloud and VOIP.
The following files are loaded from the directory <executable dir>/translations
- retroshare_*.qm
- LinksCloud_*.qm
- VOIP_*.qm

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5664 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-10-11 23:46:54 +00:00
parent cc84a0338e
commit 8c5fd1d124
3 changed files with 12 additions and 5 deletions

View File

@ -105,7 +105,10 @@ QTranslator* LinksCloudPlugin::qt_translator(QApplication */*app*/, const QStrin
}
QTranslator* translator = new QTranslator();
if (translator->load(":/lang/LinksCloud_" + languageCode + ".qm")) {
if (translator->load(QCoreApplication::applicationDirPath() + "/translations/LinksCloud_" + languageCode + ".qm")) {
return translator;
} else if (translator->load(":/lang/LinksCloud_" + languageCode + ".qm")) {
return translator;
}

View File

@ -164,7 +164,10 @@ QTranslator* VOIPPlugin::qt_translator(QApplication */*app*/, const QString& lan
}
QTranslator* translator = new QTranslator();
if (translator->load(":/lang/VOIP_" + languageCode + ".qm")) {
if (translator->load(QCoreApplication::applicationDirPath() + "/translations/VOIP_" + languageCode + ".qm")) {
return translator;
} else if (translator->load(":/lang/VOIP_" + languageCode + ".qm")) {
return translator;
}

View File

@ -153,8 +153,7 @@ LanguageSupport::translate(const QString &languageCode)
if (languageCode == "en")
return true;
/* Attempt to load the translations for Qt's internal widgets from their
* installed Qt directory. */
/* 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);
@ -176,7 +175,9 @@ LanguageSupport::translate(const QString &languageCode)
bool result = true;
if (retroshareTranslator->load(":/lang/retroshare_" + languageCode + ".qm")) {
if (retroshareTranslator->load(QCoreApplication::applicationDirPath() + "/translations/retroshare_" + languageCode + ".qm")) {
QApplication::installTranslator(retroshareTranslator);
} else if (retroshareTranslator->load(":/lang/retroshare_" + languageCode + ".qm")) {
QApplication::installTranslator(retroshareTranslator);
} else {
delete retroshareTranslator;