mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Make language scripts callable from anywhere
This commit is contained in:
parent
3a8cc43e13
commit
945ea1cf28
|
@ -1,6 +1,9 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import twlang
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import twlang
|
||||||
|
|
||||||
|
os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])) + "/../..")
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
langs = sys.argv[1:]
|
langs = sys.argv[1:]
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import twlang
|
import twlang
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])) + "/../..")
|
||||||
|
|
||||||
if len(sys.argv) < 3:
|
if len(sys.argv) < 3:
|
||||||
print("usage: python copy_fix.py <infile> <outfile> [--delete-unused] [--append-missing] [--delete-empty]")
|
print("usage: python copy_fix.py <infile> <outfile> [--delete-unused] [--append-missing] [--delete-empty]")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import twlang
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import twlang
|
||||||
|
|
||||||
|
os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])) + "/../..")
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print("usage: python find_unchanged.py <file>")
|
print("usage: python find_unchanged.py <file>")
|
||||||
|
|
|
@ -47,20 +47,18 @@ def check_file(path):
|
||||||
|
|
||||||
|
|
||||||
def check_folder(path):
|
def check_folder(path):
|
||||||
files = os.listdir(path)
|
|
||||||
englishlist = set()
|
englishlist = set()
|
||||||
for f in files:
|
for path, _, files in os.walk(path):
|
||||||
newpath = os.path.join(path, f)
|
for f in files:
|
||||||
if os.path.isdir(newpath):
|
if not any(f.endswith(x) for x in ".cpp .c .h".split()):
|
||||||
englishlist.update(check_folder(newpath))
|
continue
|
||||||
elif os.path.isfile(newpath):
|
englishlist.update(check_file(os.path.join(path, f)))
|
||||||
englishlist.update(check_file(newpath))
|
|
||||||
return englishlist
|
return englishlist
|
||||||
|
|
||||||
|
|
||||||
def languages():
|
def languages():
|
||||||
index = decode(open("../../data/languages/index.txt"), 2)
|
index = decode(open("data/languages/index.txt"), 2)
|
||||||
langs = {"../"+key+".txt" : [key]+elements for key, elements in index.items()}
|
langs = {"data/languages/"+key+".txt" : [key]+elements for key, elements in index.items()}
|
||||||
return langs
|
return langs
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,5 +68,5 @@ def translations(filename):
|
||||||
|
|
||||||
|
|
||||||
def localizes():
|
def localizes():
|
||||||
englishlist = list(check_folder("../../src"))
|
englishlist = list(check_folder("src"))
|
||||||
return englishlist
|
return englishlist
|
||||||
|
|
Loading…
Reference in a new issue