summaryrefslogtreecommitdiffstats
path: root/share/templates/i18n.py
diff options
context:
space:
mode:
Diffstat (limited to 'share/templates/i18n.py')
-rwxr-xr-xshare/templates/i18n.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/share/templates/i18n.py b/share/templates/i18n.py
new file mode 100755
index 0000000..96593b6
--- /dev/null
+++ b/share/templates/i18n.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python3
+
+from xml.dom import minidom
+import sys
+
+elements = ["inkscape:_name", "inkscape:_shortdesc", "inkscape:_keywords"]
+
+sys.stdout.write("char * stringlst = [")
+
+for filename in sys.argv[1:]:
+ doc = minidom.parse(filename)
+ templates = doc.getElementsByTagName('inkscape:_templateinfo')
+
+ if templates:
+ for element in elements:
+ lines = templates[0].getElementsByTagName(element)
+ if lines:
+ sys.stdout.write("N_(\"" + lines[0].firstChild.nodeValue + "\"),")
+
+sys.stdout.write("];")