9a6f3ef547
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3959 178a84e3-b1eb-0310-8ba1-8eac791a3b58
37 lines
928 B
Python
Executable File
37 lines
928 B
Python
Executable File
import xml.dom.minidom
|
|
import sys
|
|
|
|
f = open('./data/po/gui_strings.h', 'w')
|
|
|
|
def traverse(node, level=0):
|
|
|
|
for e in node.childNodes:
|
|
if e.localName == None:
|
|
continue
|
|
|
|
#print ' '*level, e.localName
|
|
|
|
comment = None
|
|
if e.hasAttribute("I18N"):
|
|
comment = e.getAttribute("I18N")
|
|
|
|
if e.hasAttribute("text"):
|
|
# print "Label=", e.getAttribute("text"), " Comment=", comment
|
|
line = ""
|
|
if comment == None:
|
|
line += "_(\"" + e.getAttribute("text") + "\")\n\n"
|
|
else:
|
|
line += "//I18N: " + comment + "\n_(\"" + e.getAttribute("text") + "\");\n\n"
|
|
|
|
f.write( line )
|
|
|
|
|
|
traverse(e, level+1)
|
|
|
|
filenames = sys.argv[1:]
|
|
for file in filenames:
|
|
print "Parsing", file
|
|
doc = xml.dom.minidom.parse(file)
|
|
traverse(doc)
|
|
|