changed translation file lookup

This commit is contained in:
Martchus 2015-08-25 19:16:43 +02:00
parent 8a05677bb3
commit 7ba1b2ba58
1 changed files with 11 additions and 2 deletions

View File

@ -59,6 +59,9 @@ void loadQtTranslationFile()
if(qtTranslator->load(QStringLiteral("qt_%1").arg(locale.name()),
QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
QCoreApplication::installTranslator(qtTranslator);
} else if(qtTranslator->load(QStringLiteral("qt_%1").arg(locale.name()), QStringLiteral("../share/qt/translations"))) {
// used in Windows
QCoreApplication::installTranslator(qtTranslator);
} else {
delete qtTranslator;
cout << "Unable to load Qt translation file for the language " << locale.name().toStdString() << "." << endl;
@ -71,8 +74,10 @@ void loadQtTranslationFile()
* \param applicationName Specifies the name of the application.
* \remarks Translation files have to be placed in one of the following
* locations:
* - /usr/share/$application/translations
* - ./translations
* - /usr/share/$application/translations (used in UNIX)
* - ../share/$application/translations (used in Windows)
* - ./projects/%1/translations (used during developement with subdirs project)
* Translation files must be named using the following scheme:
* - $application_$language.qm
*/
@ -91,8 +96,10 @@ void loadApplicationTranslationFile(const QString &applicationName)
* \param localName Specifies the name of the locale.
* \remarks Translation files have to be placed in one of the following
* locations:
* - /usr/share/$application/translations
* - ./translations
* - /usr/share/$application/translations (used in UNIX)
* - ../share/$application/translations (used in Windows)
* - ./projects/%1/translations (used during developement with subdirs project)
* Translation files must be named using the following scheme:
* - $application_$language.qm
*/
@ -106,6 +113,8 @@ void loadApplicationTranslationFile(const QString &applicationName, const QStrin
QCoreApplication::installTranslator(appTranslator);
} else if(appTranslator->load(fileName, QStringLiteral("/usr/share/%1/translations").arg(applicationName))) {
QCoreApplication::installTranslator(appTranslator);
} else if(appTranslator->load(fileName, QStringLiteral("../share/%1/translations").arg(applicationName))) {
QCoreApplication::installTranslator(appTranslator);
} else {
delete appTranslator;
if(localeName != QStringLiteral("en_US")) {