aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/texteditor/snippets
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2018-01-19 11:16:19 +0100
committerDavid Schulz <david.schulz@qt.io>2018-02-16 06:09:20 +0000
commitb795cc152c01e6ca937954c7b99f71e3a324b6ff (patch)
tree76343c9163213d2718eea0ef6b9d2e109b5b4f9a /src/plugins/texteditor/snippets
parentb96044888707d3e6bdd872b8ae5a586cafb6741b (diff)
Editor: make additional snippet info translatable
Additional snippet information is displayed in the options and when completing snippets to distinguish between multiple snippets with the same trigger. This information is extracted from xml files. Translate these strings like the information for external tools. Task-number: QTCREATORBUG-5912 Change-Id: I90a22d687a99339b8f30c0de3b04b379085b6bd5 Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'src/plugins/texteditor/snippets')
-rw-r--r--src/plugins/texteditor/snippets/snippetscollection.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/plugins/texteditor/snippets/snippetscollection.cpp b/src/plugins/texteditor/snippets/snippetscollection.cpp
index 20c9615d5a6..2aeed388555 100644
--- a/src/plugins/texteditor/snippets/snippetscollection.cpp
+++ b/src/plugins/texteditor/snippets/snippetscollection.cpp
@@ -44,6 +44,13 @@
using namespace TextEditor;
using namespace Internal;
+/* TRANSLATOR TextEditor::Internal::Snippets
+
+ Snippets are text fragments that can be inserted into an editor via the usual completion
+ mechanics using a trigger text. The translated text (trigger variant) is used to
+ disambiguate between snippets with the same trigger.
+*/
+
namespace {
static bool snippetComp(const Snippet &a, const Snippet &b)
@@ -359,7 +366,10 @@ QList<Snippet> SnippetsCollection::readXML(const QString &fileName, const QStrin
if (isGroupKnown(groupId) && (snippetId.isEmpty() || snippetId == id)) {
Snippet snippet(groupId, id);
snippet.setTrigger(atts.value(kTrigger).toString());
- snippet.setComplement(atts.value(kComplement).toString());
+ snippet.setComplement(QCoreApplication::translate(
+ "TextEditor::Internal::Snippets",
+ atts.value(kComplement).toString().toLatin1(),
+ atts.value(kId).toString().toLatin1()));
snippet.setIsRemoved(toBool(atts.value(kRemoved).toString()));
snippet.setIsModified(toBool(atts.value(kModified).toString()));