Set EOL property on code file and remove backups (foo~).

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11832 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
mbjornstk 2012-10-30 23:31:09 +00:00
parent 2c83fafdfc
commit dc721ec44a
2 changed files with 0 additions and 127 deletions

View File

@ -1,92 +0,0 @@
import xml.dom.minidom
import sys
import codecs
f = open('./data/po/gui_strings.h', 'w')
f.write( codecs.BOM_UTF8 )
def traverse(file, node, isChallenge, isGP, isKart, isTrack, 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.localName == "subtitle" and e.hasAttribute("text") and len(e.getAttribute("text")) > 0:
#print "Label=", e.getAttribute("name"), " Comment=", comment
line = ""
if comment == None:
line += "//I18N: " + file + "\n_(\"" + e.getAttribute("text") + "\")\n\n"
else:
line += "//I18N: File : " + file + "\n//I18N: " + comment + "\n_(\"" + e.getAttribute("text") + "\");\n\n"
f.write( line.encode( "utf-8" ) )
if isChallenge or isGP or isKart or isTrack:
if e.hasAttribute("name") and len(e.getAttribute("name")) > 0:
#print "Label=", e.getAttribute("name"), " Comment=", comment
line = ""
if comment == None:
line += "//I18N: " + file + "\n_(\"" + e.getAttribute("name") + "\")\n\n"
else:
line += "//I18N: File : " + file + "\n//I18N: " + comment + "\n_(\"" + e.getAttribute("name") + "\");\n\n"
f.write( line.encode( "utf-8" ) )
# challenges and GPs can have a description file; karts don't
if e.hasAttribute("description") and len(e.getAttribute("description")) > 0:
# print "Label=", e.getAttribute("description"), " Comment=", comment
line = ""
if comment == None:
line += "//I18N: " + file + "\n_(\"" + e.getAttribute("description") + "\")\n\n"
else:
line += "//I18N: File : " + file + "\n//I18N: " + comment + "\n_(\"" + e.getAttribute("description") + "\");\n\n"
f.write( line.encode( "utf-8" ) )
else:
if e.hasAttribute("text") and len(e.getAttribute("text")) > 0:
# print "Label=", e.getAttribute("text"), " Comment=", comment
line = ""
if comment == None:
line += "//I18N: " + file + "\n_(\"" + e.getAttribute("text") + "\")\n\n"
else:
line += "//I18N: " + file + "\n//I18N: " + comment + "\n_(\"" + e.getAttribute("text") + "\");\n\n"
f.write( line.encode( "utf-8" ) )
# 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, isTrack, level+1)
filenames = sys.argv[1:]
for file in filenames:
#print "Parsing", file
isChallenge = False
isGP = False
isKart = False
isTrack = False
if file.endswith(".challenge"):
isChallenge = True
if file.endswith(".grandprix"):
isGP = True
if file.endswith("kart.xml"):
isKart = True
if file.endswith("track.xml"):
isTrack = True
try:
doc = xml.dom.minidom.parse(file)
except Exception as ex:
print "============================================"
print "/!\\ Expat doesn't like ", file, "! Error=", type(ex), " (", ex.args, ")"
print "============================================"
traverse(file, doc, isChallenge, isGP, isKart, isTrack)

View File

@ -1,35 +0,0 @@
# run this script from the root directory to re-generate the .pot file
#
# ./data/po/update_pot.sh
CPP_FILE_LIST="`find ./src -name '*.cpp' -print` `find ./src -name '*.hpp' -print`"
XML_FILE_LIST="`find ./data -name 'track.xml' -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 :"
echo "--------------------"
echo $CPP_FILE_LIST
echo "--------------------"
echo " XML Files :"
echo "--------------------"
echo $XML_FILE_LIST
echo $OTHER_XML_FILES
# XML Files
python ./data/po/extract_strings_from_XML.py $XML_FILE_LIST $OTHER_XML_FILES
echo "---------------------------"
echo " Generating .pot file..."
# C++ Files
xgettext -d supertuxkart -s --keyword=_ --keyword=N_ --keyword=_LTR --keyword=_C:1c,2 --add-comments="I18N:" -p ./data/po -o supertuxkart.pot $CPP_FILE_LIST --package-name=supertuxkart
# XML Files
xgettext -j -d supertuxkart -s --keyword=_ --add-comments="I18N:" -p ./data/po -o supertuxkart.pot --from-code=UTF-8 ./data/po/gui_strings.h --package-name=supertuxkart
echo " Done"
echo "---------------------------"