mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Port lang scripts to Python3
This commit is contained in:
parent
af2d86765c
commit
85a15fe442
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
import twlang
|
||||
import sys
|
||||
|
||||
|
@ -13,7 +13,7 @@ for lang in langs:
|
|||
empty = 0
|
||||
supported = 0
|
||||
unused = 0
|
||||
for tran, (_, expr, _) in trans.iteritems():
|
||||
for tran, (_, expr, _) in trans.items():
|
||||
if not expr:
|
||||
empty += 1
|
||||
else:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
import twlang
|
||||
import sys
|
||||
|
||||
|
@ -28,7 +28,7 @@ if delete_unused or append_missing:
|
|||
local = twlang.localizes()
|
||||
if append_missing:
|
||||
supported = []
|
||||
for tran, (start, expr, end) in trans.iteritems():
|
||||
for tran, (start, expr, end) in trans.items():
|
||||
if delete_unused and tran not in local:
|
||||
content[start:end] = [None]*(end-start)
|
||||
if append_missing and tran in local:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
import twlang
|
||||
import sys
|
||||
|
||||
|
@ -8,6 +8,6 @@ if len(sys.argv) < 2:
|
|||
infile = sys.argv[1]
|
||||
|
||||
trans = twlang.translations(infile)
|
||||
for tran, (_, expr, _) in trans.iteritems():
|
||||
for tran, (_, expr, _) in trans.items():
|
||||
if tran == expr:
|
||||
print(tran)
|
||||
|
|
|
@ -12,7 +12,7 @@ def decode(fileobj, elements_per_key):
|
|||
data = {}
|
||||
current_key = None
|
||||
for index, line in enumerate(fileobj):
|
||||
line = line.decode("utf-8-sig").encode("utf-8")
|
||||
line = line.encode("utf-8").decode("utf-8-sig")
|
||||
line = line[:-1]
|
||||
if line and line[-1] == "\r":
|
||||
line = line[:-1]
|
||||
|
@ -60,7 +60,7 @@ def check_folder(path):
|
|||
|
||||
def languages():
|
||||
index = decode(open("../index.txt"), 2)
|
||||
langs = {"../"+key+".txt" : [key]+elements for key, elements in index.iteritems()}
|
||||
langs = {"../"+key+".txt" : [key]+elements for key, elements in index.items()}
|
||||
return langs
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue