summaryrefslogtreecommitdiffstats
path: root/share/templates/i18n.py
blob: 96593b623b7364caa281f90d10df39cc11313028 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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("];")