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

List:       kde-commits
Subject:    [kxmlgui] src: fix displaying local menu entries translated
From:       Lukáš Tinkl <lukas () kde ! org>
Date:       2014-07-21 14:09:12
Message-ID: E1X9EHA-0001G4-L9 () scm ! kde ! org
[Download RAW message or body]

Git commit a899bac076f56ab9ffed342f8cc4b5795993f5bf by Lukáš Tinkl.
Committed on 21/07/2014 at 14:06.
Pushed by lukas into branch 'master'.

fix displaying local menu entries translated

as the local entries come from an application domain, we need
to retry getting the translation from there to override the kxmlgui5
domain set globally for this library

dfaure: any better idea to achieve this?

CCMAIL: faure@kde.org

M  +13   -2    src/kxmlguibuilder.cpp

http://commits.kde.org/kxmlgui/a899bac076f56ab9ffed342f8cc4b5795993f5bf

diff --git a/src/kxmlguibuilder.cpp b/src/kxmlguibuilder.cpp
index f7420f1..f4e3d18 100644
--- a/src/kxmlguibuilder.cpp
+++ b/src/kxmlguibuilder.cpp
@@ -179,14 +179,25 @@ QWidget *KXMLGUIBuilder::createContainer(QWidget *parent, int \
index, const QDomE  const QString text = textElem.text();
         const QString context = textElem.attribute(d->attrContext);
 
+        //qDebug(260) << "DOMAIN" << KLocalizedString::applicationDomain();
+        //qDebug(260) << "ELEMENT TEXT:" << text;
+
         if (text.isEmpty()) { // still no luck
             i18nText = i18n("No text");
         } else if (context.isEmpty()) {
-            i18nText = i18n(qPrintable(text));
+            i18nText = i18n(text.toUtf8().constData());
+            if (i18nText == text)  { // try with app domain
+                i18nText = i18nd(KLocalizedString::applicationDomain().constData(), \
text.toUtf8().constData()); +            }
         } else {
-            i18nText = i18nc(qPrintable(context), qPrintable(text));
+            i18nText = i18nc(context.toUtf8().constData(), \
text.toUtf8().constData()); +            if (i18nText == text)  { // try with app \
domain +                i18nText = \
i18ndc(KLocalizedString::applicationDomain().constData(), \
context.toUtf8().constData(), text.toUtf8().constData()); +            }
         }
 
+        //qDebug(260) << "ELEMENT i18n TEXT:" << i18nText;
+
         const QString icon = element.attribute(d->attrIcon);
         QIcon pix;
         if (!icon.isEmpty()) {


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

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