diff options
author | Kai Koehne <kai.koehne@qt.io> | 2018-06-28 16:47:11 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@qt.io> | 2018-07-18 06:40:36 +0000 |
commit | e6f6c4aee6951a2c8f00ac628cea544a61e9021c (patch) | |
tree | 9c16204477e9ec8b250762634fdb3ad13e8b3e9e /tools/qml | |
parent | e792c08ef2bb4d4676df2fe7cc4537ea993d07d2 (diff) |
Use QTranslator::install(QLocale, ...) everywhere
QTranslator::install(QLocale, ...) indirectly uses
QLocale::uiLanguages(), which is the correct way to
ask the system for ui languages.
This was already attempted once in commit 427646b8d7,
but reverted later on in commit 05d8ffb4df, because
it requires shipping .qm files for the native language.
Anyhow, we're shipping empty Qt translations for English
since a while, and also have been fixing our examples
to do so.
[ChangeLog][Important Behavior Changes]
The automatic translation loading in qml, qmlscene
and QQmlApplicationEngine now tries to load translations
for all languages in QLocale::uiLanguages().
This might require shipping an empty translation for the
source language.
Task-number: QTBUG-7329
Task-number: QTBUG-41977
Task-number: QTBUG-69196
Change-Id: Ifcf45b453ee9d05c018f379cc01e192d1b0a3f56
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'tools/qml')
-rw-r--r-- | tools/qml/main.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 6cf6ad3b2c..7dfae2b53d 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -535,10 +535,9 @@ int main(int argc, char *argv[]) verboseMode = false; #if QT_CONFIG(translation) - //qt_ translations loaded by QQmlApplicationEngine - QString sysLocale = QLocale::system().name(); - - if (!translationFile.isEmpty()) { //Note: installed before QQmlApplicationEngine's automatic translation loading + // Need to be installed before QQmlApplicationEngine's automatic translation loading + // (qt_ translations are loaded there) + if (!translationFile.isEmpty()) { QTranslator translator; if (translator.load(translationFile)) { |