summaryrefslogtreecommitdiffstats
path: root/src/sdk
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2020-02-04 08:52:00 +0100
committerAndy Shaw <andy.shaw@qt.io>2020-03-26 07:28:33 +0000
commitdce65c258373f06c0f3ba6029a4c6da251aa33ee (patch)
tree2ba0749eb603d33cae2f54d886388da9df58d2b8 /src/sdk
parentc0732c406741bbd3d8d16f32f599e7ce83155c85 (diff)
Provide a means to use fixed translations for Qt and IFW
Since building Qt statically and then IFW can be seen as a lot to do just to be able to provide a fixed translation for a Qt or IFW string then it is better to provide a means to override these translations. So if a translation is found inside :/translations_new then it will use this one instead of the one found at :/translations for Qt or IFW strings. This can be provided via the -r option when using binarycreator then. Change-Id: I007c45ff96ccf5d73b54a5df8a80a2a05c2f35c6 Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'src/sdk')
-rw-r--r--src/sdk/installerbase.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp
index e6cf150ca..7613d12f4 100644
--- a/src/sdk/installerbase.cpp
+++ b/src/sdk/installerbase.cpp
@@ -272,12 +272,18 @@ int InstallerBase::run()
}
const QString directory = QLatin1String(":/translations");
+ // Check if there is a modified translation first to enable people
+ // to easily provide corrected translations to Qt/IFW for their installers
+ const QString newDirectory = QLatin1String(":/translations_new");
const QStringList translations = m_core->settings().translations();
if (translations.isEmpty()) {
foreach (const QLocale locale, QLocale().uiLanguages()) {
QScopedPointer<QTranslator> qtTranslator(new QTranslator(QCoreApplication::instance()));
- const bool qtLoaded = qtTranslator->load(locale, QLatin1String("qt"),
+ bool qtLoaded = qtTranslator->load(locale, QLatin1String("qt"),
+ QLatin1String("_"), newDirectory);
+ if (!qtLoaded)
+ qtLoaded = qtTranslator->load(locale, QLatin1String("qt"),
QLatin1String("_"), directory);
if (qtLoaded || locale.language() == QLocale::English) {
@@ -285,7 +291,10 @@ int InstallerBase::run()
QCoreApplication::instance()->installTranslator(qtTranslator.take());
QScopedPointer<QTranslator> ifwTranslator(new QTranslator(QCoreApplication::instance()));
- if (ifwTranslator->load(locale, QLatin1String("ifw"), QLatin1String("_"), directory))
+ bool ifwLoaded = ifwTranslator->load(locale, QLatin1String("ifw"), QLatin1String("_"), newDirectory);
+ if (!ifwLoaded)
+ ifwLoaded = ifwTranslator->load(locale, QLatin1String("ifw"), QLatin1String("_"), directory);
+ if (ifwLoaded)
QCoreApplication::instance()->installTranslator(ifwTranslator.take());
// To stop loading other translations it's sufficient that