summaryrefslogtreecommitdiff
path: root/share/qtcreator/translations
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 /share/qtcreator/translations
parentb96044888707d3e6bdd872b8ae5a586cafb6741b (diff)
downloadqt-creator-b795cc152c01e6ca937954c7b99f71e3a324b6ff.tar.gz
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 'share/qtcreator/translations')
-rw-r--r--share/qtcreator/translations/extract-snippets.xq9
-rw-r--r--share/qtcreator/translations/translations.pro9
2 files changed, 16 insertions, 2 deletions
diff --git a/share/qtcreator/translations/extract-snippets.xq b/share/qtcreator/translations/extract-snippets.xq
new file mode 100644
index 0000000000..0b7e52d476
--- /dev/null
+++ b/share/qtcreator/translations/extract-snippets.xq
@@ -0,0 +1,9 @@
+let $prefix := string("QT_TRANSLATE_NOOP3(&quot;TextEditor::Internal::Snippets&quot;, &quot;")
+let $midfix := string("&quot;, &quot;")
+let $suffix := concat("&quot;)", codepoints-to-string(10))
+for $file in tokenize($files, string("\|"))
+ for $snippet in (doc($file)/*/snippet)
+ let $group := fn:concat(string("group:'"), data($snippet/@group), string("' "))
+ let $trigger := fn:concat(string("trigger:'"), data($snippet/@trigger), string("'"))
+ where ($snippet/@complement)
+ return fn:concat($prefix, data($snippet/@complement), $midfix, $group, $trigger, $suffix)
diff --git a/share/qtcreator/translations/translations.pro b/share/qtcreator/translations/translations.pro
index 5f752f2855..9a3e296dda 100644
--- a/share/qtcreator/translations/translations.pro
+++ b/share/qtcreator/translations/translations.pro
@@ -27,6 +27,7 @@ JSONWIZARD_TR_H = $$OUT_PWD/jsonwizard_tr.h
QMLWIZARD_TR_H = $$OUT_PWD/qmlwizard_tr.h
QTQUICKWIZARD_TR_H = $$OUT_PWD/qtquickwizard_tr.h
EXTERNALTOOLS_TR_H = $$OUT_PWD/externaltools_tr.h
+SNIPPETS_TR_H = $$OUT_PWD/snippets_tr.h
win32: \
PREFIX = "file:///"
@@ -48,12 +49,16 @@ QTQUICKWIZARD_FILES = \"$$join(QTQUICKWIZARD_FILES, "|$$PREFIX", "$$PREFIX")\"
for(file, $$list($$files($$IDE_SOURCE_TREE/src/share/qtcreator/externaltools/*))):EXTERNALTOOLS_FILES += $$files($$file)
EXTERNALTOOLS_FILES = \"$$join(EXTERNALTOOLS_FILES, "|$$PREFIX", "$$PREFIX")\"
+for(file, $$list($$files($$IDE_SOURCE_TREE/share/qtcreator/snippets/*))):SNIPPETS_FILES += $$files($$file)
+SNIPPETS_FILES = \"$$join(SNIPPETS_FILES, "|$$PREFIX", "$$PREFIX")\"
+
extract.commands += \
$$XMLPATTERNS -output $$MIME_TR_H -param files=$$MIMETYPES_FILES $$PWD/extract-mimetypes.xq $$escape_expand(\\n\\t) \
$$XMLPATTERNS -output $$CUSTOMWIZARD_TR_H -param files=$$CUSTOMWIZARD_FILES $$PWD/extract-customwizards.xq $$escape_expand(\\n\\t) \
$$XMLPATTERNS -output $$QMLWIZARD_TR_H -param files=$$QMLWIZARD_FILES $$PWD/extract-qmlwizards.xq $$escape_expand(\\n\\t) \
$$XMLPATTERNS -output $$QTQUICKWIZARD_TR_H -param files=$$QTQUICKWIZARD_FILES $$PWD/extract-qtquickwizards.xq $$escape_expand(\\n\\t) \
$$XMLPATTERNS -output $$EXTERNALTOOLS_TR_H -param files=$$EXTERNALTOOLS_FILES $$PWD/extract-externaltools.xq $$escape_expand(\\n\\t) \
+ $$XMLPATTERNS -output $$SNIPPETS_TR_H -param files=$$SNIPPETS_FILES $$PWD/extract-snippets.xq $$escape_expand(\\n\\t) \
$(QMAKE) -o Makefile.jsonwizard JSONWIZARD_TR_H=\"$$JSONWIZARD_TR_H\" TOP_LEVEL=\"$$IDE_SOURCE_TREE/share/qtcreator/templates/wizards\" $$PWD/jsonwizard_tr.pro
QMAKE_EXTRA_TARGETS += extract
@@ -77,12 +82,12 @@ files = $$files($$PWD/*_??.ts) $$PWD/qtcreator_untranslated.ts
for(file, files) {
lang = $$replace(file, .*_([^/]*)\\.ts, \\1)
v = ts-$${lang}.commands
- $$v = cd $$wd && $$LUPDATE $$include_options $$sources $$MIME_TR_H $$CUSTOMWIZARD_TR_H $$JSONWIZARD_TR_H $$QMLWIZARD_TR_H $$QTQUICKWIZARD_TR_H $$EXTERNALTOOLS_TR_H -ts $$file
+ $$v = cd $$wd && $$LUPDATE $$include_options $$sources $$MIME_TR_H $$CUSTOMWIZARD_TR_H $$JSONWIZARD_TR_H $$QMLWIZARD_TR_H $$QTQUICKWIZARD_TR_H $$EXTERNALTOOLS_TR_H $$SNIPPETS_TR_H -ts $$file
v = ts-$${lang}.depends
$$v = extract
QMAKE_EXTRA_TARGETS += ts-$$lang
}
-ts-all.commands = cd $$wd && $$LUPDATE $$include_options $$sources $$MIME_TR_H $$CUSTOMWIZARD_TR_H $$JSONWIZARD_TR_H $$QMLWIZARD_TR_H $$QTQUICKWIZARD_TR_H $$EXTERNALTOOLS_TR_H -ts $$files
+ts-all.commands = cd $$wd && $$LUPDATE $$include_options $$sources $$MIME_TR_H $$CUSTOMWIZARD_TR_H $$JSONWIZARD_TR_H $$QMLWIZARD_TR_H $$QTQUICKWIZARD_TR_H $$EXTERNALTOOLS_TR_H SNIPPETS_TR_H -ts $$files
ts-all.depends = extract
QMAKE_EXTRA_TARGETS += ts-all