Improve unicode string extraction

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8122 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-03-30 17:12:29 +00:00
parent 66cb1f729b
commit 03fb11823b
7 changed files with 113 additions and 1140 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,9 @@
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):
@ -24,7 +26,7 @@ def traverse(file, node, isChallenge, isGP, isKart, isTrack, level=0):
else:
line += "//I18N: File : " + file + "\n//I18N: " + comment + "\n_(\"" + e.getAttribute("name") + "\");\n\n"
f.write( line )
f.write( line.encode( "utf-8" ) )
# challenges and GPs can have a description file; karts don't
if e.hasAttribute("description"):
@ -35,7 +37,7 @@ def traverse(file, node, isChallenge, isGP, isKart, isTrack, level=0):
else:
line += "//I18N: File : " + file + "\n//I18N: " + comment + "\n_(\"" + e.getAttribute("description") + "\");\n\n"
f.write( line )
f.write( line.encode( "utf-8" ) )
else:
if e.hasAttribute("text"):
# print "Label=", e.getAttribute("text"), " Comment=", comment
@ -45,7 +47,7 @@ def traverse(file, node, isChallenge, isGP, isKart, isTrack, level=0):
else:
line += "//I18N: " + file + "\n//I18N: " + comment + "\n_(\"" + e.getAttribute("text") + "\");\n\n"
f.write( line )
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:

File diff suppressed because it is too large Load Diff

View File

@ -29,10 +29,10 @@ echo " Generating .pot file..."
xgettext -d supertuxkart -s --keyword=_ --keyword=_LTR --add-comments="I18N:" -p ./data/po -o supertuxkart.pot $CPP_FILE_LIST --package-name=supertuxkart
# Lisp files
xgettext -j -L lisp -d supertuxkart -s --keyword=_ --add-comments="I18N:" -p ./data/po -o supertuxkart.pot $XML_FILE_LIST --package-name=supertuxkart
#xgettext -j -L lisp -d supertuxkart -s --keyword=_ --add-comments="I18N:" -p ./data/po -o supertuxkart.pot $XML_FILE_LIST --package-name=supertuxkart
# XML Files
xgettext -j -d supertuxkart -s --keyword=_ --add-comments="I18N:" -p ./data/po -o supertuxkart.pot ./data/po/gui_strings.h --package-name=supertuxkart
xgettext -j -d supertuxkart -s --keyword=_ --add-comments="I18N:" -p ./data/po -o supertuxkart.pot --from-code=UTF-16 ./data/po/gui_strings.h --package-name=supertuxkart
echo " Done"
echo "---------------------------"