mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 01:24:18 +00:00
Merge #1185
1185: Port lang scripts to Python3 r=heinrich5991 a=rffontenelle Scripts for managing translations are currently available for Python 2. DDNet already uses Python 3, so it make sense IMO to have these scripts using this version as well. Co-authored-by: Rafael Fontenelle <rafaelff@gnome.org>
This commit is contained in:
commit
861746a641
|
@ -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