From 05d8ffb4dff5e693967c8ee7cee6d6158eadccbd Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 16 Oct 2014 10:10:04 +0200 Subject: Revert: use the new form of QTranslator::load() for more flexibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 427646b8d7c52e5b84240e07ffd391217ce3bfa8. It seems that it should have been more correct, but we are still not shipping English translations, and static QString find_translation() in qtranslator.cpp will return any language which is in QLocale::uiLanguages() for which the translation file is found. That is a long list on OSX. Reverting the patch means find_translation() is not called in such cases. This change can be re-done whenever we are more sure that the attempt to find a translation will succeed in finding a sensible one, or fall back to not translating, rather than choosing a language that the user didn't intend. Task-number: QTBUG-41977 Change-Id: I425946cc71cec96b4f38629eb2b7e80220c5236d Reviewed-by: Jan Arve Sæther --- src/qml/qml/qqmlapplicationengine.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/qml/qml/qqmlapplicationengine.cpp b/src/qml/qml/qqmlapplicationengine.cpp index 9ccaee7cd7..240c01233b 100644 --- a/src/qml/qml/qqmlapplicationengine.cpp +++ b/src/qml/qml/qqmlapplicationengine.cpp @@ -65,8 +65,7 @@ void QQmlApplicationEnginePrivate::init() q->connect(q, SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit())); #ifndef QT_NO_TRANSLATION QTranslator* qtTranslator = new QTranslator; - QLocale locale; - if (qtTranslator->load(locale, QLatin1String("qt"), QLatin1String("_"), QLibraryInfo::location(QLibraryInfo::TranslationsPath))) + if (qtTranslator->load(QLatin1String("qt_") + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath))) QCoreApplication::installTranslator(qtTranslator); translators << qtTranslator; #endif @@ -83,8 +82,7 @@ void QQmlApplicationEnginePrivate::loadTranslations(const QUrl &rootFile) QFileInfo fi(rootFile.toLocalFile()); QTranslator *translator = new QTranslator; - QLocale locale; - if (translator->load(locale, QLatin1String("qml"), QLatin1String("_"), fi.path() + QLatin1String("/i18n"))) { + if (translator->load(QLatin1String("qml_") + QLocale::system().name(), fi.path() + QLatin1String("/i18n"))) { QCoreApplication::installTranslator(translator); translators << translator; } else { -- cgit v1.2.3