From b6f7abb809bdc59e52e9b0003d5e0764932f908f Mon Sep 17 00:00:00 2001 From: Harald Sitter Date: Fri, 28 May 2021 14:27:15 +0200 Subject: [PATCH] do not eval i18ncp when there's no data this caused an unnecessary warning. when the list is empty the join results in "" which is considered invalid for the reference of %2 leading to ki18n warning that not enough arguments were supplied. simply return an empty string when the message is not visible --- kcms/translations/package/contents/ui/main.qml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/kcms/translations/package/contents/ui/main.qml b/kcms/translations/package/contents/ui/main.qml index f643bfec8..ba498880f 100644 --- a/kcms/translations/package/contents/ui/main.qml +++ b/kcms/translations/package/contents/ui/main.qml @@ -157,11 +157,18 @@ ScrollViewKCM { type: Kirigami.MessageType.Error - text: i18ncp("@info %2 is the language code", - "The translation files for the language with the code '%2' could not be found. The language will be removed from your configuration. If you want to add it back, please install the localization files for it and add the language again.", - "The translation files for the languages with the codes '%2' could not be found. These languages will be removed from your configuration. If you want to add them back, please install the localization files for it and add the languages again.", - kcm.selectedTranslationsModel.missingLanguages.length, - kcm.selectedTranslationsModel.missingLanguages.join(i18nc("@info separator in list of language codes", "', '"))) + text: { + // Don't eval the i18ncp call when we have no missing languages. It causes unnecesssary warnings + // as %2 will be "" and thus considered missing. + if (!visible) { + return "" + } + i18ncp("@info %2 is the language code", + "The translation files for the language with the code '%2' could not be found. The language will be removed from your configuration. If you want to add it back, please install the localization files for it and add the language again.", + "The translation files for the languages with the codes '%2' could not be found. These languages will be removed from your configuration. If you want to add them back, please install the localization files for it and add the languages again.", + kcm.selectedTranslationsModel.missingLanguages.length, + kcm.selectedTranslationsModel.missingLanguages.join(i18nc("@info separator in list of language codes", "', '"))) + } visible: kcm.selectedTranslationsModel.missingLanguages.length > 0 }