diff options
author | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2020-08-25 18:12:32 +0300 |
---|---|---|
committer | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2020-08-26 07:14:37 +0000 |
commit | 2efc27fc698e18afc98f1c414e5519cf455d95c2 (patch) | |
tree | 8e3d1b26107163d4342eea5714795f48fb21e337 | |
parent | 7ab0658e79f44e98dba9baba05c3e704adc4d0ee (diff) |
Allow disabling translation features with environment variable
'IFW_DISABLE_TRANSLATIONS' can be used to disable translation features
with a value of '1', '0' or any other values are ignored. The variable
is evaluated at the time of running qmake.
Task-number: QTIFW-1911
Change-Id: I99c472eae4229b8add109fcf7f764f670909231d
Reviewed-by: Katja Marttila <katja.marttila@qt.io>
-rw-r--r-- | installerfw.pri | 5 | ||||
-rw-r--r-- | src/libs/installer/component.cpp | 4 | ||||
-rw-r--r-- | src/sdk/installerbase.cpp | 4 |
3 files changed, 9 insertions, 4 deletions
diff --git a/installerfw.pri b/installerfw.pri index ad2369d4d..4c8e7175e 100644 --- a/installerfw.pri +++ b/installerfw.pri @@ -12,6 +12,11 @@ IFW_VERSION_STR_WIN32 = $$IFW_VERSION_STR\0 IFW_REPOSITORY_FORMAT_VERSION = 1.0.0 IFW_NEWLINE = $$escape_expand(\\n\\t) +isEmpty(IFW_DISABLE_TRANSLATIONS): IFW_DISABLE_TRANSLATIONS = $$(IFW_DISABLE_TRANSLATIONS) +isEqual(IFW_DISABLE_TRANSLATIONS, 1) { + DEFINES += IFW_DISABLE_TRANSLATIONS +} + defineTest(minQtVersion) { maj = $$1 min = $$2 diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp index 234d57622..40c5b7340 100644 --- a/src/libs/installer/component.cpp +++ b/src/libs/installer/component.cpp @@ -346,12 +346,12 @@ void Component::loadDataFromPackage(const Package &package) .split(QInstaller::commaRegExp(), QString::SkipEmptyParts); if (!uis.isEmpty()) loadUserInterfaces(QDir(QString::fromLatin1("%1/%2").arg(localTempPath(), name())), uis); - +#ifndef IFW_DISABLE_TRANSLATIONS const QStringList qms = package.data(QLatin1String("Translations")).toString() .split(QInstaller::commaRegExp(), QString::SkipEmptyParts); if (!qms.isEmpty()) loadTranslations(QDir(QString::fromLatin1("%1/%2").arg(localTempPath(), name())), qms); - +#endif QHash<QString, QVariant> licenseHash = package.data(QLatin1String("Licenses")).toHash(); if (!licenseHash.isEmpty()) loadLicenses(QString::fromLatin1("%1/%2/").arg(localTempPath(), name()), licenseHash); diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp index 914be33f6..ee710a1ea 100644 --- a/src/sdk/installerbase.cpp +++ b/src/sdk/installerbase.cpp @@ -85,7 +85,7 @@ int InstallerBase::run() } qCDebug(QInstaller::lcInstallerInstallLog) << "Language:" << QLocale().uiLanguages() .value(0, QLatin1String("No UI language set")).toUtf8().constData(); - +#ifndef IFW_DISABLE_TRANSLATIONS 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 @@ -124,7 +124,7 @@ int InstallerBase::run() QCoreApplication::instance()->installTranslator(translator.take()); } } - +#endif { QDirIterator fontIt(QStringLiteral(":/fonts")); while (fontIt.hasNext()) { |