mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-06-27 16:10:30 +08:00
Update german locale (#1166)
also:
sort keys in json alphabetically
change the way files are printed to be grouped by language.
This will be spicy since we have many german speakers here.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from collections import defaultdict
|
||||
from glob import glob
|
||||
from json import load
|
||||
from os import path
|
||||
@@ -23,10 +24,10 @@ def get_missing(en_json, translation_json):
|
||||
|
||||
def print_result(missing, not_translated, file):
|
||||
if len(missing):
|
||||
print("[{0}] - missing: {1} {2}".format(path.basename(path.dirname(file)), path.basename(file), missing))
|
||||
print("[{0}] - {1}\tmissing: {2}".format(path.basename(path.dirname(file)), path.basename(file), missing))
|
||||
if len(not_translated):
|
||||
print(
|
||||
"[{0}] - potentially untranslated: {1} {2}".format(
|
||||
"[{0}] - {1}\tpotentially untranslated: {2}".format(
|
||||
path.basename(path.dirname(file)), path.basename(file), not_translated
|
||||
)
|
||||
)
|
||||
@@ -35,14 +36,20 @@ def print_result(missing, not_translated, file):
|
||||
def audit(file, en_file):
|
||||
en_json = load(open(en_file))
|
||||
translation_json = load(open(file))
|
||||
print_result(get_missing(en_json, translation_json), get_not_translated(en_json, translation_json), file)
|
||||
return (get_missing(en_json, translation_json), get_not_translated(en_json, translation_json), file)
|
||||
|
||||
|
||||
def main():
|
||||
per_language_dict = defaultdict(list)
|
||||
for en_file in glob(path.join(DIR, EN_PATH)):
|
||||
for file in glob(path.join(DIR, ALL_PATH)):
|
||||
if path.basename(en_file) == path.basename(file) and file != en_file:
|
||||
audit(file, en_file)
|
||||
file_info = audit(file, en_file)
|
||||
lang = path.basename(path.dirname(file))
|
||||
per_language_dict[lang].append(file_info)
|
||||
for results in per_language_dict.values():
|
||||
list(map(lambda args: print_result(*args), results))
|
||||
print()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user