Update to translation script to pick up kart names + fixed many instances where gettext or the XML parser would complain
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5851 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
4f603d7dc1
commit
1bfaf9d4f5
@ -13,12 +13,12 @@
|
||||
<icon-button id="tab_update" width="128" height="128" icon="gui/package.png"
|
||||
I18N="Section in the addons menu" text="Update"/>
|
||||
</tabs>
|
||||
|
||||
<box proportion="1" width="100%" layout="vertical-row">
|
||||
|
||||
<label id="update_status" width="100%" height="10%" text_align="left" text="" />
|
||||
<spacer height="5%" width="100%"/>
|
||||
<list id="list_addons" height="50%" proportion="5" width="100%" align="center"/>
|
||||
<spacer height="15%" width="100%"/>
|
||||
<label id="update_status" width="100%" height="10%" text_align="left" />
|
||||
<spacer height="5%" width="100%"/>
|
||||
<list id="list_addons" height="50%" proportion="5" width="100%" align="center"/>
|
||||
<spacer height="15%" width="100%"/>
|
||||
</box>
|
||||
|
||||
<spacer width="50" height="45" />
|
||||
|
@ -13,12 +13,12 @@
|
||||
<icon-button id="tab_update" width="128" height="128" icon="gui/package.png"
|
||||
I18N="Section in the addons menu" text="Update"/>
|
||||
</tabs>
|
||||
|
||||
<box proportion="1" width="100%" layout="vertical-row">
|
||||
|
||||
<label id="update_status" width="100%" height="10%" text_align="left" text="" />
|
||||
<spacer height="5%" width="100%"/>
|
||||
<list id="list_addons" height="50%" proportion="5" width="100%" align="center"/>
|
||||
<spacer height="15%" width="100%"/>
|
||||
<label id="update_status" width="100%" height="10%" text_align="left" />
|
||||
<spacer height="5%" width="100%"/>
|
||||
<list id="list_addons" height="50%" proportion="5" width="100%" align="center"/>
|
||||
<spacer height="15%" width="100%"/>
|
||||
</box>
|
||||
|
||||
<spacer width="50" height="45" />
|
||||
|
@ -3,7 +3,7 @@
|
||||
<placeholder id="result-table" width="96%" proportion="1">
|
||||
<!-- Contents is added programatically -->
|
||||
</placeholder>
|
||||
<spacer height="10" height="2%" width="96%"/>
|
||||
<spacer height="10" width="96%"/>
|
||||
<!-- The actual button texts will vary depending on what type of race
|
||||
was being run, and if something was unlocked etc. So we don't
|
||||
specify a text here, and label the buttons :
|
||||
@ -13,9 +13,9 @@
|
||||
Setting text=" " is important, otherwise the height of the
|
||||
widget is incorrect. -->
|
||||
<button id="top" align="center" width="60%" text=" "/>
|
||||
<spacer height="10" height="2%" width="96%"/>
|
||||
<spacer height="10" width="96%"/>
|
||||
<button id="middle" align="center" width="60%" text=" "/>
|
||||
<spacer height="10" height="2%" width="96%"/>
|
||||
<spacer height="10" width="96%"/>
|
||||
<button id="bottom" align="center" width="60%" text=" "/>
|
||||
</div>
|
||||
</stkgui>
|
||||
|
@ -3,7 +3,7 @@ import sys
|
||||
|
||||
f = open('./data/po/gui_strings.h', 'w')
|
||||
|
||||
def traverse(file, node, isChallenge, isGP, level=0):
|
||||
def traverse(file, node, isChallenge, isGP, isKart, level=0):
|
||||
|
||||
for e in node.childNodes:
|
||||
if e.localName == None:
|
||||
@ -15,7 +15,7 @@ def traverse(file, node, isChallenge, isGP, level=0):
|
||||
if e.hasAttribute("I18N"):
|
||||
comment = e.getAttribute("I18N")
|
||||
|
||||
if isChallenge or isGP:
|
||||
if isChallenge or isGP or isKart:
|
||||
if e.hasAttribute("name"):
|
||||
# print "Label=", e.getAttribute("name"), " Comment=", comment
|
||||
line = ""
|
||||
@ -25,7 +25,8 @@ def traverse(file, node, isChallenge, isGP, level=0):
|
||||
line += "//I18N: File : " + file + "\n//I18N: " + comment + "\n_(\"" + e.getAttribute("name") + "\");\n\n"
|
||||
|
||||
f.write( line )
|
||||
|
||||
|
||||
# challenges and GPs can have a description file; karts don't
|
||||
if e.hasAttribute("description"):
|
||||
# print "Label=", e.getAttribute("description"), " Comment=", comment
|
||||
line = ""
|
||||
@ -46,8 +47,9 @@ def traverse(file, node, isChallenge, isGP, level=0):
|
||||
|
||||
f.write( line )
|
||||
|
||||
|
||||
traverse(file, e, isChallenge, isGP, level+1)
|
||||
# don't recurse in children nodes for karts, they can contain sounds, etc. that should not be translated
|
||||
if not isKart:
|
||||
traverse(file, e, isChallenge, isGP, isKart, level+1)
|
||||
|
||||
filenames = sys.argv[1:]
|
||||
for file in filenames:
|
||||
@ -55,18 +57,21 @@ for file in filenames:
|
||||
|
||||
isChallenge = False
|
||||
isGP = False
|
||||
isKart = False
|
||||
|
||||
if file.endswith(".challenge"):
|
||||
isChallenge = True
|
||||
if file.endswith(".grandprix"):
|
||||
isGP = True
|
||||
if file.endswith("kart.xml"):
|
||||
isKart = True
|
||||
|
||||
try:
|
||||
doc = xml.dom.minidom.parse(file)
|
||||
except:
|
||||
except Exception as ex:
|
||||
print "============================================"
|
||||
print "/!\\ Expat doesn't like ", file, "!"
|
||||
print "/!\\ Expat doesn't like ", file, "! Error=", type(ex), " (", ex.args, ")"
|
||||
print "============================================"
|
||||
|
||||
traverse(file, doc, isChallenge, isGP)
|
||||
traverse(file, doc, isChallenge, isGP, isKart)
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,7 @@
|
||||
CPP_FILE_LIST="`find ./src -name '*.cpp' -print` `find ./src -name '*.hpp' -print`"
|
||||
LISP_FILE_LIST="`find ./data -name '*.track' -print` `find ./data -name '*.challenge' -print` `find ./data -name '*.grandprix' -print`"
|
||||
#XML_FILE_LIST=`find ./data -name '*.xml' -print`
|
||||
OTHER_XML_FILES=`find ./data -name '*.stkgui' -print && find ./data -name '*.challenge' -print && find ./data -name '*.grandprix' -print`
|
||||
OTHER_XML_FILES=`find ./data -name '*.stkgui' -print && find ./data -name '*.challenge' -print && find ./data -name '*.grandprix' -print && find ./data -name 'kart.xml' -print`
|
||||
|
||||
echo "--------------------"
|
||||
echo " Source Files :"
|
||||
@ -13,14 +13,10 @@ echo "--------------------"
|
||||
echo $CPP_FILE_LIST
|
||||
|
||||
echo "--------------------"
|
||||
echo " Data Files :"
|
||||
echo " XML Files :"
|
||||
echo "--------------------"
|
||||
echo $LISP_FILE_LIST
|
||||
|
||||
echo "--------------------"
|
||||
echo " XMl Files :"
|
||||
echo "--------------------"
|
||||
echo $OTHER_XML_FILES # $XML_FILE_LIST
|
||||
echo $OTHER_XML_FILES
|
||||
|
||||
# XML Files
|
||||
python ./data/po/extract_strings_from_XML.py $OTHER_XML_FILES
|
||||
|
@ -51,7 +51,7 @@ const wchar_t* getCakeString()
|
||||
case 1: return _("%0 is dubious of %1's cooking skills");
|
||||
//I18N: shown when hit by cake. %1 is the attacker, %0 is the victim.
|
||||
case 2: return _("%0 should not play with %1's lunch");
|
||||
default: assert(false); return _(""); // avoid compiler warning
|
||||
default: assert(false); return L""; // avoid compiler warning
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ const wchar_t* getBowlingString()
|
||||
case 1 : return _("%1 strikes %0");
|
||||
//I18N: shown when hit by bowling ball. %1 is the attacker, %0 is the victim.
|
||||
case 2 : return _("%0 is bowled over by %1");
|
||||
default: assert(false); return _(""); // avoid compiler warning
|
||||
default: assert(false); return L""; // avoid compiler warning
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ const wchar_t* getPlungerInFaceString()
|
||||
case 0: return _("%0 gets a fancy mask from %1");
|
||||
//I18N: shown when a player receives a plunger in his face
|
||||
case 1: return _("%1 merges %0's face with a plunger");
|
||||
default:assert(false); return _(""); // avoid compiler warning
|
||||
default:assert(false); return L""; // avoid compiler warning
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ const wchar_t* getAnchorString()
|
||||
case 0: return _("Arrr, the %s dropped anchor, Captain!");
|
||||
case 1: return _("%s pays the next round of grog!");
|
||||
case 2: return _("%s is a mighty pirate!");
|
||||
default: assert(false); return _(""); // avoid compiler warning.
|
||||
default: assert(false); return L""; // avoid compiler warning.
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ const wchar_t* getParachuteString()
|
||||
case 0: return _("Geronimo!!!"); // Parachutist shout
|
||||
case 1: return _("The Space Shuttle has landed!");
|
||||
case 2: return _("Do you want to fly kites?");
|
||||
default: assert(false); return _(""); // avoid compiler warning
|
||||
default: assert(false); return L""; // avoid compiler warning
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ const wchar_t* getSwapperString()
|
||||
case 0: return _("Magic, son. Nothing else in the world smells like that.");
|
||||
case 1: return _("A wizard did it!");
|
||||
case 2: return _("Banana? Box? Banana? Box? Banana? Box?");
|
||||
default: assert(false); return _(""); // avoid compiler warning
|
||||
default: assert(false); return L""; // avoid compiler warning
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ const wchar_t* getPlungerString()
|
||||
case 1: return _("%1 latches onto %0 for a free ride");
|
||||
//I18N: shown when hit by plunger. %0 is the victim, %1 is the attacker
|
||||
case 2: return _("%1 tests a tractor beam on %0");
|
||||
default: assert(false); return _(""); // avoid warning about no return value
|
||||
default: assert(false); return L""; // avoid warning about no return value
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user