summaryrefslogtreecommitdiffstats
path: root/share/paint/i18n.py
diff options
context:
space:
mode:
Diffstat (limited to 'share/paint/i18n.py')
-rwxr-xr-xshare/paint/i18n.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/share/paint/i18n.py b/share/paint/i18n.py
new file mode 100755
index 0000000..ff3f7f5
--- /dev/null
+++ b/share/paint/i18n.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+
+from xml.dom import minidom
+import sys
+
+
+sys.stdout.write("char * stringlst = [")
+
+for rawdoc in sys.argv[1:]:
+ doc = minidom.parse(rawdoc)
+
+ for title in doc.getElementsByTagName('title'):
+ ret = ""
+ for child in title.childNodes:
+ if child.nodeType == child.TEXT_NODE:
+ ret += child.data
+ if ret:
+ ret = ret.replace("\n", "").replace("\"", "'")
+ sys.stdout.write("N_(\"" + ret + "\"),")
+
+ for filter in doc.getElementsByTagName('pattern'):
+ stockid = filter.getAttribute('inkscape:stockid')
+ if stockid == "":
+ stockid = filter.getAttribute('inkscape:label')
+ if stockid != "":
+ sys.stdout.write("N_(\"" + stockid + "\"),")
+
+sys.stdout.write("];")