[latexila] Build Tools: manage translations with ITS Tool



commit 8c8f7654afdd42ffa0749d56c8e06b993cfaa859
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Sun Jul 17 23:56:05 2011 +0200

    Build Tools: manage translations with ITS Tool

 TODO                                       |    1 -
 data/build_tools/CMakeLists.txt            |   33 +++++++++++++-
 data/build_tools/build_tools-en.xml        |   32 +++++++-------
 data/build_tools/build_tools.its           |    7 +++
 data/build_tools/build_tools.pot           |   63 +++++++++++++++++++++++++++
 data/build_tools/fr.po                     |   64 ++++++++++++++++++++++++++++
 data/build_tools/update_build_tools_pot.sh |    7 +++
 7 files changed, 188 insertions(+), 19 deletions(-)
---
diff --git a/TODO b/TODO
index df3d25a..69ee81f 100644
--- a/TODO
+++ b/TODO
@@ -7,7 +7,6 @@ LaTeXila 2.2
 ============
 
 - use ITS tool (http://itstool.org/):
-	- for the build tools
 	- for the templates
 	- ...?
 
diff --git a/data/build_tools/CMakeLists.txt b/data/build_tools/CMakeLists.txt
index 61496d8..7f0520d 100644
--- a/data/build_tools/CMakeLists.txt
+++ b/data/build_tools/CMakeLists.txt
@@ -1,2 +1,31 @@
-file (GLOB tools *.xml)
-install (FILES ${tools} DESTINATION ${DATA_DIR}/build_tools)
+set (bt_dir ${DATA_DIR}/build_tools)
+set (tmp_bt_dir "${latexila_BINARY_DIR}/data/build_tools")
+
+install (FILES build_tools-en.xml DESTINATION ${DATA_DIR}/build_tools)
+
+set (all_new_bt)
+
+# Foreach language
+file (GLOB po_files *.po)
+foreach (po_file ${po_files})
+	# Get the language name
+	get_filename_component (lang ${po_file} NAME_WE)
+
+	# Generate the new XML file
+	set (new_bt "${tmp_bt_dir}/build_tools-${lang}.xml")
+	set (mo_file "${tmp_bt_dir}/${lang}.mo")
+	add_custom_command (
+		OUTPUT ${new_bt}
+		COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo_file} ${po_file}
+		COMMAND mkdir ${tmp_bt_dir}/${lang}
+		COMMAND itstool -m ${mo_file} -o ${tmp_bt_dir}/${lang}/ ${latexila_SOURCE_DIR}/data/build_tools/build_tools-en.xml
+		COMMAND mv ${tmp_bt_dir}/${lang}/build_tools-en.xml ${new_bt}
+		DEPENDS ${po_file}
+	)
+
+	install (FILES ${new_bt} DESTINATION ${DATA_DIR}/build_tools)
+
+	set (all_new_bt ${all_new_bt} ${new_bt})
+endforeach ()
+
+add_custom_target (build_tools ALL DEPENDS ${all_new_bt})
diff --git a/data/build_tools/build_tools-en.xml b/data/build_tools/build_tools-en.xml
index 9403e13..8dc22be 100644
--- a/data/build_tools/build_tools-en.xml
+++ b/data/build_tools/build_tools-en.xml
@@ -1,32 +1,32 @@
-<tools>
+<tools xmlns:its="http://www.w3.org/2005/11/its";>
   <!-- Latexmk -->
 
   <tool show="true" extensions=".tex" icon="compile_pdf">
-    <label>LaTeX â PDF (Latexmk)</label>
+    <label its:translate="no">LaTeX â PDF (Latexmk)</label>
     <job mustSucceed="true" postProcessor="latexmk">latexmk -pdf $filename</job>
     <job mustSucceed="true" postProcessor="no-output">$view $shortname.pdf</job>
   </tool>
 
   <tool show="true" extensions=".tex" icon="compile_dvi">
-    <label>LaTeX â DVI â PDF (Latexmk)</label>
+    <label its:translate="no">LaTeX â DVI â PDF (Latexmk)</label>
     <job mustSucceed="true" postProcessor="latexmk">latexmk -pdfdvi $filename</job>
     <job mustSucceed="true" postProcessor="no-output">$view $shortname.pdf</job>
   </tool>
 
   <tool show="true" extensions=".tex" icon="compile_ps">
-    <label>LaTeX â DVI â PS â PDF (Latexmk)</label>
+    <label its:translate="no">LaTeX â DVI â PS â PDF (Latexmk)</label>
     <job mustSucceed="true" postProcessor="latexmk">latexmk -pdfps $filename</job>
     <job mustSucceed="true" postProcessor="no-output">$view $shortname.pdf</job>
   </tool>
 
   <tool show="false" extensions=".tex" icon="compile_dvi">
-    <label>LaTeX â DVI (Latexmk)</label>
+    <label its:translate="no">LaTeX â DVI (Latexmk)</label>
     <job mustSucceed="true" postProcessor="latexmk">latexmk $filename</job>
     <job mustSucceed="true" postProcessor="no-output">$view $shortname.dvi</job>
   </tool>
 
   <tool show="false" extensions=".tex" icon="compile_ps">
-    <label>LaTeX â DVI â PS (Latexmk)</label>
+    <label its:translate="no">LaTeX â DVI â PS (Latexmk)</label>
     <job mustSucceed="true" postProcessor="latexmk">latexmk -ps $filename</job>
     <job mustSucceed="true" postProcessor="no-output">$view $shortname.ps</job>
   </tool>
@@ -54,7 +54,7 @@
   <!-- Rubber -->
 
   <tool show="false" extensions=".tex" icon="compile_pdf">
-    <label>LaTeX â PDF (Rubber)</label>
+    <label its:translate="no">LaTeX â PDF (Rubber)</label>
     <job mustSucceed="true" postProcessor="rubber">
       rubber --maxerr -1 --short --force --warn all --pdf $filename
     </job>
@@ -62,7 +62,7 @@
   </tool>
 
   <tool show="false" extensions=".tex" icon="compile_dvi">
-    <label>LaTeX â DVI (Rubber)</label>
+    <label its:translate="no">LaTeX â DVI (Rubber)</label>
     <job mustSucceed="true" postProcessor="rubber">
       rubber --maxerr -1 --short --force --warn all $filename
     </job>
@@ -70,7 +70,7 @@
   </tool>
 
   <tool show="false" extensions=".tex" icon="compile_ps">
-    <label>LaTeX â DVI â PS (Rubber)</label>
+    <label its:translate="no">LaTeX â DVI â PS (Rubber)</label>
     <job mustSucceed="true" postProcessor="rubber">
       rubber --maxerr -1 --short --force --warn all --ps $filename
     </job>
@@ -80,13 +80,13 @@
   <!-- latex, pdflatex -->
 
   <tool show="false" extensions=".tex" icon="compile_pdf">
-    <label>LaTeX â PDF (pdflatex)</label>
+    <label its:translate="no">LaTeX â PDF (pdflatex)</label>
     <description>Create a PDF file from LaTeX sources with the 'pdflatex' command</description>
     <job mustSucceed="true" postProcessor="latex">pdflatex -interaction=nonstopmode $filename</job>
   </tool>
 
   <tool show="false" extensions=".tex" icon="compile_dvi">
-    <label>LaTeX â DVI (latex)</label>
+    <label its:translate="no">LaTeX â DVI (latex)</label>
     <description>Create a DVI file from LaTeX sources with the 'latex' command</description>
     <job mustSucceed="true" postProcessor="latex">latex -interaction=nonstopmode $filename</job>
   </tool>
@@ -94,13 +94,13 @@
   <!-- BibTeX, MakeIndex -->
 
   <tool show="false" extensions=".tex" icon="gtk-execute">
-    <label>BibTeX</label>
+    <label its:translate="no">BibTeX</label>
     <description>Run BibTeX (bibliography)</description>
     <job mustSucceed="true" postProcessor="all-output">bibtex $shortname.aux</job>
   </tool>
 
   <tool show="false" extensions=".tex" icon="gtk-execute">
-    <label>MakeIndex</label>
+    <label its:translate="no">MakeIndex</label>
     <description>Run MakeIndex</description>
     <job mustSucceed="true" postProcessor="all-output">makeindex $shortname.idx</job>
   </tool>
@@ -108,19 +108,19 @@
   <!-- Convert -->
 
   <tool show="false" extensions=".tex" icon="gtk-convert">
-    <label>DVI â PDF</label>
+    <label its:translate="no">DVI â PDF</label>
     <description>Convert the DVI document to the PDF format</description>
     <job mustSucceed="true" postProcessor="all-output">dvipdf $shortname.dvi</job>
   </tool>
 
   <tool show="false" extensions=".tex" icon="gtk-convert">
-    <label>DVI â PS</label>
+    <label its:translate="no">DVI â PS</label>
     <description>Convert the DVI document to the PostScript format</description>
     <job mustSucceed="true" postProcessor="all-output">dvips $shortname.dvi</job>
   </tool>
 
   <tool show="false" extensions=".tex" icon="gtk-convert">
-    <label>PS â PDF</label>
+    <label its:translate="no">PS â PDF</label>
     <description>Convert the PostScript document to the PDF format</description>
     <job mustSucceed="true" postProcessor="all-output">ps2pdf $shortname.ps</job>
   </tool>
diff --git a/data/build_tools/build_tools.its b/data/build_tools/build_tools.its
new file mode 100644
index 0000000..7277cdb
--- /dev/null
+++ b/data/build_tools/build_tools.its
@@ -0,0 +1,7 @@
+<its:rules
+    xmlns:its="http://www.w3.org/2005/11/its";
+    its:version="1.0">
+
+    <its:translateRule translate="no" selector="//job" />
+
+</its:rules>
diff --git a/data/build_tools/build_tools.pot b/data/build_tools/build_tools.pot
new file mode 100644
index 0000000..e30b262
--- /dev/null
+++ b/data/build_tools/build_tools.pot
@@ -0,0 +1,63 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2011-07-17 23:53+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL ADDRESS>\n"
+"Language-Team: LANGUAGE <LL li org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: build_tools-en.xml:37(tool/label)
+msgid "View PDF"
+msgstr ""
+
+#: build_tools-en.xml:38(tool/description)
+msgid "View the PDF file"
+msgstr ""
+
+#: build_tools-en.xml:43(tool/label)
+msgid "View DVI"
+msgstr ""
+
+#: build_tools-en.xml:44(tool/description)
+msgid "View the DVI file"
+msgstr ""
+
+#: build_tools-en.xml:49(tool/label)
+msgid "View PS"
+msgstr ""
+
+#: build_tools-en.xml:50(tool/description)
+msgid "View the PostScript file"
+msgstr ""
+
+#: build_tools-en.xml:84(tool/description)
+msgid "Create a PDF file from LaTeX sources with the 'pdflatex' command"
+msgstr ""
+
+#: build_tools-en.xml:90(tool/description)
+msgid "Create a DVI file from LaTeX sources with the 'latex' command"
+msgstr ""
+
+#: build_tools-en.xml:98(tool/description)
+msgid "Run BibTeX (bibliography)"
+msgstr ""
+
+#: build_tools-en.xml:104(tool/description)
+msgid "Run MakeIndex"
+msgstr ""
+
+#: build_tools-en.xml:112(tool/description)
+msgid "Convert the DVI document to the PDF format"
+msgstr ""
+
+#: build_tools-en.xml:118(tool/description)
+msgid "Convert the DVI document to the PostScript format"
+msgstr ""
+
+#: build_tools-en.xml:124(tool/description)
+msgid "Convert the PostScript document to the PDF format"
+msgstr ""
+
diff --git a/data/build_tools/fr.po b/data/build_tools/fr.po
new file mode 100644
index 0000000..a675a6e
--- /dev/null
+++ b/data/build_tools/fr.po
@@ -0,0 +1,64 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: LaTeXila 2.1\n"
+"POT-Creation-Date: 2011-07-17 23:53+0200\n"
+"PO-Revision-Date: 2011-07-17 23:59+0100\n"
+"Last-Translator: SÃbastien Wilmet <sebastien wilmet gmail com>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-Language: French\n"
+
+#: build_tools-en.xml:37(tool/label)
+msgid "View PDF"
+msgstr "Voir PDF"
+
+#: build_tools-en.xml:38(tool/description)
+msgid "View the PDF file"
+msgstr "Voir le fichier PDF"
+
+#: build_tools-en.xml:43(tool/label)
+msgid "View DVI"
+msgstr "Voir DVI"
+
+#: build_tools-en.xml:44(tool/description)
+msgid "View the DVI file"
+msgstr "Voir le fichier DVI"
+
+#: build_tools-en.xml:49(tool/label)
+msgid "View PS"
+msgstr "Voir PS"
+
+#: build_tools-en.xml:50(tool/description)
+msgid "View the PostScript file"
+msgstr "Voir le fichier PostScript"
+
+#: build_tools-en.xml:84(tool/description)
+msgid "Create a PDF file from LaTeX sources with the 'pdflatex' command"
+msgstr "CrÃer un fichier PDF à partir des sources LaTeX grÃce à la commande ÂÂpdflatexÂÂ."
+
+#: build_tools-en.xml:90(tool/description)
+msgid "Create a DVI file from LaTeX sources with the 'latex' command"
+msgstr ""
+
+#: build_tools-en.xml:98(tool/description)
+msgid "Run BibTeX (bibliography)"
+msgstr ""
+
+#: build_tools-en.xml:104(tool/description)
+msgid "Run MakeIndex"
+msgstr ""
+
+#: build_tools-en.xml:112(tool/description)
+msgid "Convert the DVI document to the PDF format"
+msgstr ""
+
+#: build_tools-en.xml:118(tool/description)
+msgid "Convert the DVI document to the PostScript format"
+msgstr ""
+
+#: build_tools-en.xml:124(tool/description)
+msgid "Convert the PostScript document to the PDF format"
+msgstr ""
+
diff --git a/data/build_tools/update_build_tools_pot.sh b/data/build_tools/update_build_tools_pot.sh
new file mode 100755
index 0000000..fe5f19a
--- /dev/null
+++ b/data/build_tools/update_build_tools_pot.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+itstool -o build_tools.pot -i build_tools.its build_tools-en.xml
+
+for po_file in *.po; do
+	msgmerge --update --quiet --backup=none $po_file build_tools.pot
+done



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]