Add patch for language name fallback in xmlgui
authorAndre Heinecke <aheinecke@intevation.de>
Mon, 22 Feb 2016 09:52:33 +0000 (10:52 +0100)
committerAndre Heinecke <aheinecke@intevation.de>
Mon, 22 Feb 2016 09:52:33 +0000 (10:52 +0100)
* Makefile.am (EXTRA_DIST): Add patch.
* patches/kxmlgui/0005-Use-non-native-Language-name-as-fallback.patch:
 New.

--
This is upstream review request: 127136

Makefile.am
patches/kxmlgui/0005-Use-non-native-Language-name-as-fallback.patch [new file with mode: 0644]

index 18e628e..fc0f1c7 100644 (file)
@@ -43,6 +43,7 @@ EXTRA_DIST = autogen.sh README.GIT ONEWS \
         patches/kxmlgui/0002-Make-QDBus-dependency-optional.patch \
         patches/kxmlgui/0003-Make-KTextWidgets-optional.patch \
         patches/kxmlgui/0004-Cruedly-disable-KSendbugmail.patch \
+        patches/kxmlgui/0005-Use-non-native-Language-name-as-fallback.patch \
         patches/kconfigwidgets/0001-Make-QDbus-optional.patch \
         patches/kconfigwidgets/0002-Crudely-remove-KF5Auth-depedency.patch \
         patches/kiconthemes/0001-Make-DBus-optional.patch \
diff --git a/patches/kxmlgui/0005-Use-non-native-Language-name-as-fallback.patch b/patches/kxmlgui/0005-Use-non-native-Language-name-as-fallback.patch
new file mode 100644 (file)
index 0000000..f299f0e
--- /dev/null
@@ -0,0 +1,41 @@
+#! /bin/sh
+patch -p1 -l -f $* < $0
+exit $?
+
+From aa75395f2d4b203b3b764f2a3a622dc4f465e930 Mon Sep 17 00:00:00 2001
+From: Andre Heinecke <aheinecke@intevation.de>
+Date: Fri, 19 Feb 2016 14:57:57 +0100
+Subject: [PATCH] Use non native Language name as fallback
+
+Some languages like Lower German don't have a native Language
+name in Qt. So we use a fallback to avoid showing empty menu
+entries.
+---
+ src/kswitchlanguagedialog_p.cpp | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/kswitchlanguagedialog_p.cpp b/src/kswitchlanguagedialog_p.cpp
+index 039daea..531598e 100644
+--- a/src/kswitchlanguagedialog_p.cpp
++++ b/src/kswitchlanguagedialog_p.cpp
+@@ -339,12 +339,16 @@ void KSwitchLanguageDialogPrivate::fillApplicationLanguages(KLanguageButton *but
+     foreach(const QLocale &l, allLocales) {
+         QString languageCode = l.name();
+         if (l != cLocale) {
++            const QString nativeName = l.nativeLanguageName();
++            // For some languages the native name is empty. In this case use the non native language
++            // name as fallback.
++            const QString languageName = nativeName.isEmpty() ? QLocale::languageToString(l.language()) : nativeName;
+             if (!insertedLanguges.contains(languageCode) && KLocalizedString::isApplicationTranslatedInto(languageCode)) {
+-                button->insertLanguage(languageCode, l.nativeLanguageName());
++                button->insertLanguage(languageCode, languageName);
+                 insertedLanguges << languageCode;
+             } else if (stripCountryCode(&languageCode)) {
+                 if (!insertedLanguges.contains(languageCode) && KLocalizedString::isApplicationTranslatedInto(languageCode)) {
+-                    button->insertLanguage(languageCode, l.nativeLanguageName());
++                    button->insertLanguage(languageCode, languageName);
+                     insertedLanguges << languageCode;
+                 }
+             }
+--
+2.1.4