add and use ability to remove nodes

This commit is contained in:
Eric House 2014-04-12 06:37:55 -07:00
parent fe287719eb
commit 1b79bcb1c4
2 changed files with 34 additions and 22 deletions

View file

@ -102,7 +102,6 @@
<string name="player_edit_title">Hráč</string>
<string name="players_label_standalone">Hráči</string>
<string name="players_label_host">Hráči -- lokálni a očakávaní</string>
<string name="button_add_player">Pridať hráča</string>
<string name="button_juggle_players">Prehodiť hráča</string>
@ -152,16 +151,13 @@
<string name="empty">Prázdne pole/pozadie</string>
<string name="advanced">Rozšírené</string>
<string name="msg_relay_waiting">Pripojený na relay. Čakám na %1$d
hráčov.</string>
<string name="relay_alert">Chyba pripojenia</string>
<string name="msg_too_many">Chcete prihlásiť viac hráčov ako očakáva server.</string>
<string name="msg_no_room">Žiadny server si nezaregistroval miestnosť s týmto menom.</string>
<string name="msg_dup_room">Iný server si už zaregistroval miestnosť s týmto menom. Premenujte ju alebo to skúste neskôr.</string>
<string name="msg_lost_other">Relay stratil kontakt s niektorým zariadením v hre.</string>
<string name="ids_badwordsf">Slovo[á] %1$s nebolo nájdené v slovníku.</string>
<string name="ids_badwords_fmt">Slovo[á] %1$s nebolo nájdené v slovníku.</string>
<string name="badwords_accept"> Chcete napriek tomu potvrdiť tento ťah?</string>
<string name="badwords_lost"> Ťah stratený.</string>
<string name="badwords_title">Neplatné slovo[á]</string>
@ -173,11 +169,9 @@
pripojiť ako Klient.</string>
<string name="gameOver">Hra skončená</string>
<string name="movesf">Bolo zahraných %1$d ťahov</string>
<string name="moves_fmt">Bolo zahraných %1$d ťahov</string>
<!-- about dialog stuff -->
<string name="about_versf">Crosswords pre Android, Verzia %1$s,
revize %2$s.</string>
<string name="about_copyright">Copyright (C) 1998-2012 Eric
House. Tento software je vydaný pod licenciou GNU Public License.</string>

View file

@ -1,6 +1,6 @@
#!/usr/bin/python
import mk_xml, os, sys, codecs
import mk_xml, os, sys, getopt
from lxml import etree
@ -19,23 +19,35 @@ def checkAgainst( path, pairs ):
print "looking at", path
doc = etree.parse( path )
root = doc.getroot();
done = False
for child in root.iter():
if done: break
if child.tag == "string":
name = child.get("name")
if not name in pairs:
candidate = longestCommon( name, pairs )
if not candidate: continue
print name, "not found in the English strings"
print "closest I can find is", candidate
print "here are the two strings, English then the other"
print pairs[candidate]
print child.text
response = raw_input( "replace %s with %s? (y, n, s or q)" % (name, candidate) )
if response == 'y':
child.set('name', candidate)
elif response == 's':
print 'English:', pairs[candidate]
print 'Other: ', child.text
print 'Replace %s with %s?' % (name, candidate)
while True:
response = raw_input( "Yes, No, Remove, Save or Quit?" ).lower()
if response == 'n':
pass
elif response == 'y':
child.set( 'name', candidate )
elif response == 'r':
root.remove( child )
elif response == 's':
done = True
elif response == 'q':
sys.exit(0)
else:
continue
break
elif response == 'q':
sys.exit(0)
# try = tryNames( name, pairs )
# response = raw_input( "unknown name: %s; respond:" % (name) )
# print "you wrote:", response
@ -48,13 +60,19 @@ def checkAgainst( path, pairs ):
def main():
stringsFiles = []
pairs, rest = getopt.getopt(sys.argv[1:], "f:")
for option, value in pairs:
if option == '-f': stringsFiles.append(value)
pairs = mk_xml.getStrings()
for subdir, dirs, files in os.walk('res_src'):
for file in [file for file in files if file == "strings.xml"]:
path = "%s/%s" % (subdir, file)
checkAgainst( path, pairs )
sys.exit(0)
if 0 == len(stringsFiles):
for subdir, dirs, files in os.walk('res_src'):
for file in [file for file in files if file == "strings.xml"]:
stringsFiles.append( "%s/%s" % (subdir, file) )
for path in stringsFiles:
checkAgainst( path, pairs )
##############################################################################