From 33334e2a8aa9d847172d1f6c1cf9a447dce094f9 Mon Sep 17 00:00:00 2001 From: Katja Marttila Date: Mon, 3 May 2021 15:27:54 +0300 Subject: Fix component translation loading Component translations were following the system language although allowed languages were set in config.xml using field. Also the translation file name was not correct as IFW languages has the syntax 'ifw_'. Task-number: QTIFW-2220 Change-Id: I6a6f19351cbb956accbc22bc532f7a12dde21a2f Reviewed-by: Iikka Eklund Reviewed-by: Arttu Tarkiainen --- src/libs/installer/component.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libs/installer/component.cpp') diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp index 66f333377..cb9959ba3 100644 --- a/src/libs/installer/component.cpp +++ b/src/libs/installer/component.cpp @@ -617,15 +617,15 @@ void Component::loadTranslations(const QDir &directory, const QStringList &qms) while (it.hasNext()) { const QString filename = it.next(); const QString basename = QFileInfo(filename).baseName(); - if (!uiLanguage.startsWith(QFileInfo(filename).baseName(), Qt::CaseInsensitive)) - continue; // do not load the file if it does not match the UI language if (!translations.isEmpty()) { bool found = false; foreach (const QString &translation, translations) - found |= translation.startsWith(basename, Qt::CaseInsensitive); + found |= translation.startsWith(QLatin1String("ifw_") + basename, Qt::CaseInsensitive); if (!found) // don't load the file if it does match the UI language but is not allowed to be used continue; + } else if (!uiLanguage.startsWith(QFileInfo(filename).baseName(), Qt::CaseInsensitive)) { + continue; // do not load the file if it does not match the UI language } QScopedPointer translator(new QTranslator(this)); -- cgit v1.2.3