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>
This commit is contained in:
David Schulz
2018-01-19 11:16:19 +01:00
parent b960448887
commit b795cc152c
3 changed files with 27 additions and 3 deletions

View File

@@ -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()));