mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-24 23:19:29 -05:00
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:
parent
cc84a0338e
commit
8c5fd1d124
@ -105,7 +105,10 @@ QTranslator* LinksCloudPlugin::qt_translator(QApplication */*app*/, const QStrin
|
|||||||
}
|
}
|
||||||
|
|
||||||
QTranslator* translator = new QTranslator();
|
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;
|
return translator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,10 @@ QTranslator* VOIPPlugin::qt_translator(QApplication */*app*/, const QString& lan
|
|||||||
}
|
}
|
||||||
|
|
||||||
QTranslator* translator = new QTranslator();
|
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;
|
return translator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,8 +153,7 @@ LanguageSupport::translate(const QString &languageCode)
|
|||||||
if (languageCode == "en")
|
if (languageCode == "en")
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* 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";
|
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);
|
||||||
@ -176,7 +175,9 @@ LanguageSupport::translate(const QString &languageCode)
|
|||||||
|
|
||||||
bool result = true;
|
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);
|
QApplication::installTranslator(retroshareTranslator);
|
||||||
} else {
|
} else {
|
||||||
delete retroshareTranslator;
|
delete retroshareTranslator;
|
||||||
|
Loading…
Reference in New Issue
Block a user