Revert "Allow music title to be translatable, fix #4281"

Some translator and stk fans think it is confusing
This commit is contained in:
Benau 2020-05-06 14:28:46 +08:00
parent 0db86f6d52
commit 80d1ba6b10
3 changed files with 7 additions and 19 deletions

View File

@ -5,7 +5,7 @@ import codecs
f = open('./data/po/gui_strings.h', 'w')
f.write( codecs.BOM_UTF8 )
def traverse(file, node, isChallenge, isGP, isKart, isTrack, isAchievements, isMusic, level=0):
def traverse(file, node, isChallenge, isGP, isKart, isTrack, isAchievements, level=0):
for e in node.childNodes:
if e.localName == None:
@ -16,12 +16,7 @@ def traverse(file, node, isChallenge, isGP, isKart, isTrack, isAchievements, isM
comment = None
if e.hasAttribute("I18N"):
comment = e.getAttribute("I18N")
if isMusic and e.hasAttribute("title") and len(e.getAttribute("title")) > 0:
line = ""
line += "//I18N: Music title from " + file + "\n_(\"" + e.getAttribute("title") + "\");\n\n"
f.write( line.encode( "utf-8" ) )
if e.localName == "subtitle" and e.hasAttribute("text") and len(e.getAttribute("text")) > 0:
#print "Label=", e.getAttribute("name"), " Comment=", comment
line = ""
@ -66,7 +61,7 @@ def traverse(file, node, isChallenge, isGP, isKart, isTrack, isAchievements, isM
# 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, isAchievements, isMusic, level+1)
traverse(file, e, isChallenge, isGP, isKart, isTrack, isAchievements, level+1)
filenames = sys.argv[1:]
for file in filenames:
@ -77,8 +72,7 @@ for file in filenames:
isKart = False
isTrack = False
isAchievements = False
isMusic = False
if file.endswith(".challenge"):
isChallenge = True
if file.endswith(".grandprix"):
@ -89,9 +83,7 @@ for file in filenames:
isTrack = True
if file.endswith("achievements.xml"):
isAchievements = True
if file.endswith(".music"):
isMusic = True
try:
doc = xml.dom.minidom.parse(file)
except Exception as ex:
@ -99,5 +91,5 @@ for file in filenames:
print("/!\\ Expat doesn't like ", file, "! Error=", type(ex), " (", ex.args, ")")
print("============================================")
traverse(file, doc, isChallenge, isGP, isKart, isTrack, isAchievements, isMusic)
traverse(file, doc, isChallenge, isGP, isKart, isTrack, isAchievements)

View File

@ -11,10 +11,8 @@ CPP_FILE_LIST="`find ./src \
XML_FILE_LIST="`find ./data \
../stk-assets/tracks \
../stk-assets/karts \
../stk-assets/music \
../supertuxkart-assets/tracks \
../supertuxkart-assets/karts \
../supertuxkart-assets/music \
-name 'achievements.xml' -or \
-name 'tips.xml' -or \
-name 'kart.xml' -or \
@ -22,7 +20,6 @@ XML_FILE_LIST="`find ./data \
-name 'scene.xml' -or \
-name '*.challenge' -or \
-name '*.grandprix' -or \
-name '*.music' -or \
-name '*.stkgui' | sort -n \
`"
ANGELSCRIPT_FILE_LIST="`find ./data \

View File

@ -626,9 +626,8 @@ void RaceGUIBase::drawGlobalMusicDescription()
const MusicInformation* mi = music_manager->getCurrentMusic();
if (!mi) return;
core::stringw title = translations->w_gettext(mi->getTitle().c_str());
// I18N: string used to show the song title (e.g. "Sunny Song")
core::stringw thetext = _("\"%s\"", title);
core::stringw thetext = _("\"%s\"", mi->getTitle());
core::dimension2d< u32 > textSize = font->getDimension(thetext.c_str());
int textWidth = textSize.Width;