OSDN Git Service

Fix translation of external tools.
authorEike Ziller <eike.ziller@nokia.com>
Mon, 15 Aug 2011 10:51:16 +0000 (12:51 +0200)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>
Mon, 15 Aug 2011 14:37:14 +0000 (16:37 +0200)
Change-Id: I21541c579f3be75537763ad65b63f6804c329e50
Reviewed-on: http://codereview.qt.nokia.com/2951
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
share/qtcreator/translations/extract-externaltools.xq [new file with mode: 0644]
share/qtcreator/translations/translations.pro
src/plugins/coreplugin/externaltool.cpp
src/share/qtcreator/externaltools/lrelease.xml
src/share/qtcreator/externaltools/lupdate.xml
src/share/qtcreator/externaltools/notepad_win.xml
src/share/qtcreator/externaltools/sort.xml
src/share/qtcreator/externaltools/vi.xml
src/share/qtcreator/externaltools/vi_mac.xml

diff --git a/share/qtcreator/translations/extract-externaltools.xq b/share/qtcreator/translations/extract-externaltools.xq
new file mode 100644 (file)
index 0000000..f15ce8a
--- /dev/null
@@ -0,0 +1,6 @@
+let $prefix := string("QT_TRANSLATE_NOOP(&quot;Core::Internal::ExternalTool&quot;, &quot;")
+let $suffix := concat("&quot;)", codepoints-to-string(10))
+for $file in tokenize($files, string("\|"))
+    let $doc := doc($file)
+    for $text in ($doc/*:externaltool/*:description, $doc/*:externaltool/*:displayname, $doc/*:externaltool/*:category)
+        return fn:concat($prefix, data($text), $suffix)
index 0d6e672..f07c6fe 100644 (file)
@@ -19,6 +19,7 @@ TRANSLATIONS = $$prependAll(LANGUAGES, $$PWD/qtcreator_,.ts)
 
 MIME_TR_H = $$OUT_PWD/mime_tr.h
 CUSTOMWIZARD_TR_H = $$OUT_PWD/customwizard_tr.h
+EXTERNALTOOLS_TR_H = $$OUT_PWD/externaltools_tr.h
 
 for(dir, $$list($$files($$IDE_SOURCE_TREE/src/plugins/*))):MIMETYPES_FILES += $$files($$dir/*.mimetypes.xml)
 MIMETYPES_FILES = \"$$join(MIMETYPES_FILES, |)\"
@@ -26,9 +27,13 @@ MIMETYPES_FILES = \"$$join(MIMETYPES_FILES, |)\"
 for(dir, $$list($$files($$IDE_SOURCE_TREE/share/qtcreator/templates/wizards/*))):CUSTOMWIZARD_FILES += $$files($$dir/wizard.xml)
 CUSTOMWIZARD_FILES = \"$$join(CUSTOMWIZARD_FILES, |)\"
 
+for(file, $$list($$files($$IDE_SOURCE_TREE/src/share/qtcreator/externaltools/*))):EXTERNALTOOLS_FILES += $$files($$file)
+EXTERNALTOOLS_FILES = \"$$join(EXTERNALTOOLS_FILES, |)\"
+
 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
+    $$XMLPATTERNS -output $$CUSTOMWIZARD_TR_H -param files=$$CUSTOMWIZARD_FILES $$PWD/extract-customwizards.xq $$escape_expand(\\n\\t) \
+    $$XMLPATTERNS -output $$EXTERNALTOOLS_TR_H -param files=$$EXTERNALTOOLS_FILES $$PWD/extract-externaltools.xq
 QMAKE_EXTRA_TARGETS += extract
 
 plugin_sources = $$files($$IDE_SOURCE_TREE/src/plugins/*)
index eba6644..2681ebb 100644 (file)
@@ -45,6 +45,7 @@
 #include <utils/environment.h>
 #include <utils/fileutils.h>
 
+#include <QtCore/QCoreApplication>
 #include <QtCore/QXmlStreamReader>
 #include <QtCore/QXmlStreamWriter>
 #include <QtCore/QDir>
@@ -316,7 +317,8 @@ static void localizedText(const QStringList &locales, QXmlStreamReader *reader,
         }
     } else {
         if (*currentLocale < 0 && currentText->isEmpty()) {
-            *currentText = reader->readElementText();
+            *currentText = QCoreApplication::translate("Core::Internal::ExternalTool",
+                                                       reader->readElementText().toLatin1().constData());
         } else {
             reader->skipCurrentElement();
         }
index 6f36e39..d7159c4 100644 (file)
 -->
 <externaltool id="lrelease">
     <description>Creates qm translation files that can be used by an application from the translator's ts files</description>
-    <description xml:lang="de">Erstellt die von Anwendungen nutzbaren qm-Dateien aus ts-Dateien von Übersetzern</description>
     <displayname>Release Translations (lrelease)</displayname>
-    <displayname xml:lang="de">Übersetzungen veröffentlichen (lrelease)</displayname>
     <category>Linguist</category>
-    <category xml:lang="de">Linguist</category>
     <order>2</order>
     <executable>
         <path>%{CurrentProject:QT_INSTALL_BINS}/lrelease</path>
index 483e4e4..aa4081c 100644 (file)
 -->
 <externaltool id="lupdate">
     <description>Synchronizes translator's ts files with the program code</description>
-    <description xml:lang="de">Synchronisiert die ts-Übersetzungsdateien mit dem Programmcode</description>
     <displayname>Update Translations (lupdate)</displayname>
-    <displayname xml:lang="de">Übersetzungen aktualisieren (lupdate)</displayname>
     <category>Linguist</category>
-    <category xml:lang="de">Linguist</category>
     <order>1</order>
     <executable>
         <path>%{CurrentProject:QT_INSTALL_BINS}/lupdate</path>
index d672399..fd25d00 100644 (file)
 -->
 <externaltool id="notepad">
     <description>Opens the current file in Notepad</description>
-    <description xml:lang="de">Öffnet die aktuelle Datei in Notepad</description>
     <displayname>Edit with Notepad</displayname>
-    <displayname xml:lang="de">In Notepad öffnen</displayname>
     <category>Text</category>
-    <category xml:lang="de">Text</category>
     <executable modifiesdocument="yes">
         <path>notepad</path>
         <arguments>"%{CurrentDocument:FilePath}"</arguments>
index f73f4b1..6b5d7d8 100644 (file)
 -->
 <externaltool id="sort">
     <description>Sorts the selected text</description>
-    <description xml:lang="de">Sortiert den ausgewählten Text</description>
     <displayname>Sort Selection</displayname>
-    <displayname xml:lang="de">Auswahl Sortieren</displayname>
     <category>Text</category>
-    <category xml:lang="de">Text</category>
     <executable output="replaceselection" error="ignore">
         <path>sort</path>
         <input>%{CurrentDocument:Selection}</input>
index 8bbb55a..57fc2db 100644 (file)
 -->
 <externaltool id="vi">
     <description>Opens the current file in vi</description>
-    <description xml:lang="de">Öffnet die aktuelle Datei in vi</description>
     <displayname>Edit with vi</displayname>
-    <displayname xml:lang="de">In vi öffnen</displayname>
     <category>Text</category>
-    <category xml:lang="de">Text</category>
     <executable modifiesdocument="yes">
         <path>xterm</path>
         <arguments>-geom %{CurrentDocument:ColumnCount}x%{CurrentDocument:RowCount}+%{CurrentDocument:XPos}+%{CurrentDocument:YPos} -e vi "%{CurrentDocument:FilePath}" +%{CurrentDocument:Row}</arguments>
index 50c3533..0533e8b 100644 (file)
 -->
 <externaltool id="vi">
     <description>Opens the current file in vi</description>
-    <description xml:lang="de">Öffnet die aktuelle Datei in vi</description>
     <displayname>Edit with vi</displayname>
-    <displayname xml:lang="de">In vi öffnen</displayname>
     <category>Text</category>
-    <category xml:lang="de">Text</category>
     <executable modifiesdocument="yes">
         <path>osascript</path>
         <input>