Fixed a lot of translation crap related to XML, hacky challenge files, no GUI, etc...
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4342 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -3,7 +3,7 @@ import sys
|
||||
|
||||
f = open('./data/po/gui_strings.h', 'w')
|
||||
|
||||
def traverse(node, level=0):
|
||||
def traverse(node, isChallenge, level=0):
|
||||
|
||||
for e in node.childNodes:
|
||||
if e.localName == None:
|
||||
@@ -14,23 +14,49 @@ def traverse(node, level=0):
|
||||
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 )
|
||||
|
||||
if isChallenge:
|
||||
if e.hasAttribute("name"):
|
||||
# print "Label=", e.getAttribute("name"), " Comment=", comment
|
||||
line = ""
|
||||
if comment == None:
|
||||
line += "_(\"" + e.getAttribute("name") + "\")\n\n"
|
||||
else:
|
||||
line += "//I18N: " + comment + "\n_(\"" + e.getAttribute("name") + "\");\n\n"
|
||||
|
||||
f.write( line )
|
||||
|
||||
if e.hasAttribute("description"):
|
||||
# print "Label=", e.getAttribute("description"), " Comment=", comment
|
||||
line = ""
|
||||
if comment == None:
|
||||
line += "_(\"" + e.getAttribute("description") + "\")\n\n"
|
||||
else:
|
||||
line += "//I18N: " + comment + "\n_(\"" + e.getAttribute("description") + "\");\n\n"
|
||||
|
||||
f.write( line )
|
||||
else:
|
||||
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)
|
||||
traverse(e, isChallenge, level+1)
|
||||
|
||||
filenames = sys.argv[1:]
|
||||
for file in filenames:
|
||||
print "Parsing", file
|
||||
doc = xml.dom.minidom.parse(file)
|
||||
traverse(doc)
|
||||
|
||||
isChallenge = False
|
||||
if file.endswith(".challenge"):
|
||||
isChallenge = True
|
||||
|
||||
doc = xml.dom.minidom.parse(file)
|
||||
traverse(doc, isChallenge)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user