390b42c
From 9eb3560cfd5cd0bc9c7bf79f2c27657ee07b8f95 Mon Sep 17 00:00:00 2001
390b42c
From: Albert Astals Cid <aacid@kde.org>
390b42c
Date: Sat, 8 Aug 2009 14:40:25 +0200
390b42c
Subject: [PATCH 12/13] Add context to tr calls in QShortcut
390b42c
390b42c
Some languages have special rules for using "+" to concatenate strings and
390b42c
for example it needs to be Ctrl + Shift instead of Ctrl+Shift, adding
390b42c
context to these strings helps creating a more correct translation
390b42c
---
390b42c
 src/gui/kernel/qkeysequence.cpp |   20 ++++++++++----------
390b42c
 1 files changed, 10 insertions(+), 10 deletions(-)
390b42c
390b42c
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
390b42c
index 894f663..c17f253 100644
390b42c
--- a/src/gui/kernel/qkeysequence.cpp
390b42c
+++ b/src/gui/kernel/qkeysequence.cpp
390b42c
@@ -991,10 +991,10 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
390b42c
 
390b42c
     QList<QModifKeyName> modifs;
390b42c
     if (nativeText) {
390b42c
-        modifs << QModifKeyName(Qt::CTRL, QShortcut::tr("Ctrl").toLower().append(QLatin1Char('+')))
390b42c
-               << QModifKeyName(Qt::SHIFT, QShortcut::tr("Shift").toLower().append(QLatin1Char('+')))
390b42c
-               << QModifKeyName(Qt::ALT, QShortcut::tr("Alt").toLower().append(QLatin1Char('+')))
390b42c
-               << QModifKeyName(Qt::META, QShortcut::tr("Meta").toLower().append(QLatin1Char('+')));
390b42c
+        modifs << QModifKeyName(Qt::CTRL, QShortcut::tr("Ctrl", "Ctrl key, used for shortcuts").toLower().append(QLatin1Char('+')))
390b42c
+               << QModifKeyName(Qt::SHIFT, QShortcut::tr("Shift", "Shift key, used for shortcuts").toLower().append(QLatin1Char('+')))
390b42c
+               << QModifKeyName(Qt::ALT, QShortcut::tr("Alt", "Alt key, used for shortcuts").toLower().append(QLatin1Char('+')))
390b42c
+               << QModifKeyName(Qt::META, QShortcut::tr("Meta", "Meta key, used for shortcuts").toLower().append(QLatin1Char('+')));
390b42c
     }
390b42c
     modifs += *gmodifs; // Test non-translated ones last
390b42c
 
390b42c
@@ -1086,7 +1086,7 @@ QString QKeySequence::encodeString(int key)
390b42c
 static inline void addKey(QString &str, const QString &theKey, QKeySequence::SequenceFormat format)
390b42c
 {
390b42c
     if (!str.isEmpty())
390b42c
-        str += (format == QKeySequence::NativeText) ? QShortcut::tr("+")
390b42c
+        str += (format == QKeySequence::NativeText) ? QShortcut::tr("+", "Symbol used to concatenate keys in shortcuts")
390b42c
                                                     : QString::fromLatin1("+");
390b42c
     str += theKey;
390b42c
 }
390b42c
@@ -1111,13 +1111,13 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
390b42c
     {
390b42c
         // On other systems the order is Meta, Control, Alt, Shift
390b42c
         if ((key & Qt::META) == Qt::META)
390b42c
-            s = nativeText ? QShortcut::tr("Meta") : QString::fromLatin1("Meta");
390b42c
+            s = nativeText ? QShortcut::tr("Meta", "Meta key, used for shortcuts") : QString::fromLatin1("Meta");
390b42c
         if ((key & Qt::CTRL) == Qt::CTRL)
390b42c
-            addKey(s, nativeText ? QShortcut::tr("Ctrl") : QString::fromLatin1("Ctrl"), format);
390b42c
+            addKey(s, nativeText ? QShortcut::tr("Ctrl", "Ctrl key, used for shortcuts") : QString::fromLatin1("Ctrl"), format);
390b42c
         if ((key & Qt::ALT) == Qt::ALT)
390b42c
-            addKey(s, nativeText ? QShortcut::tr("Alt") : QString::fromLatin1("Alt"), format);
390b42c
+            addKey(s, nativeText ? QShortcut::tr("Alt", "Alt key, used for shortcuts") : QString::fromLatin1("Alt"), format);
390b42c
         if ((key & Qt::SHIFT) == Qt::SHIFT)
390b42c
-            addKey(s, nativeText ? QShortcut::tr("Shift") : QString::fromLatin1("Shift"), format);
390b42c
+            addKey(s, nativeText ? QShortcut::tr("Shift", "Shift key, used for shortcuts") : QString::fromLatin1("Shift"), format);
390b42c
     }
390b42c
 
390b42c
 
390b42c
@@ -1132,7 +1132,7 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
390b42c
             p += QChar((key-0x10000)%400+0xdc00);
390b42c
         }
390b42c
     } else if (key >= Qt::Key_F1 && key <= Qt::Key_F35) {
390b42c
-            p = nativeText ? QShortcut::tr("F%1").arg(key - Qt::Key_F1 + 1)
390b42c
+            p = nativeText ? QShortcut::tr("F%1", "Fx key, used for shortcuts").arg(key - Qt::Key_F1 + 1)
390b42c
                            : QString::fromLatin1("F%1").arg(key - Qt::Key_F1 + 1);
390b42c
     } else if (key) {
390b42c
         int i=0;
390b42c
-- 
390b42c
1.6.5.1
390b42c