[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [plasma-desktop/Plasma/5.4] kcms/keyboard: Completely fix broken translations in keyboard KCM advanc
From:       Wolfgang Bauer <wbauer () tmo ! at>
Date:       2015-09-30 12:00:17
Message-ID: E1ZhG3V-00017Q-AM () scm ! kde ! org
[Download RAW message or body]

Git commit 6d192f58efc1f4fc34e4ee1d6d072ba11a6a29a1 by Wolfgang Bauer.
Committed on 30/09/2015 at 11:58.
Pushed by wbauer into branch 'Plasma/5.4'.

Completely fix broken translations in keyboard KCM advanced page

The xkeyboard-config translation files contain the characters '<' and
'>' in HTML-escaped form. Therefore we need to convert them before/after
looking up the translation.

Note that QString::toHtmlEscaped() cannot be used here because it would
also convert '"', which is contained verbatim in the translation files.

CCBUG: 341527
REVIEW: 125462

M  +4    -1    kcms/keyboard/xkb_rules.cpp

http://commits.kde.org/plasma-desktop/6d192f58efc1f4fc34e4ee1d6d072ba11a6a2=
9a1

diff --git a/kcms/keyboard/xkb_rules.cpp b/kcms/keyboard/xkb_rules.cpp
index 27ff104..57777b9 100644
--- a/kcms/keyboard/xkb_rules.cpp
+++ b/kcms/keyboard/xkb_rules.cpp
@@ -69,7 +69,10 @@ private:
 static QString translate_xml_item(const QString& itemText)
 {
     //messages are already extracted from the source XML files by xkb
-    return i18nd("xkeyboard-config", itemText.toUtf8());
+    //the characters '<' and '>' (but not '"') are HTML-escaped in the xke=
yboard-config translation files, so we need to convert them before/after lo=
oking up the translation
+    //note that we cannot use QString::toHtmlEscaped() here because that w=
ould convert '"' as well
+    QString msgid(itemText);
+    return i18nd("xkeyboard-config", msgid.replace(QLatin1Literal("<"), QL=
atin1Literal("&lt;")).replace(QLatin1Literal(">"), QLatin1Literal("&gt;")).=
toUtf8()).replace(QLatin1Literal("&lt;"), QLatin1Literal("<")).replace(QLat=
in1Literal("&gt;"), QLatin1Literal(">"));
 }
 =

 static QString translate_description(ConfigItem* item)
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic