mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
Enhance the scripts/update_localization.py a bit
Fix a bug with mixing up new and old translations.
This commit is contained in:
parent
d73165f563
commit
7e2224b392
|
@ -72,14 +72,21 @@ def write_languagefile(outputfilename, l10n_src, old_l10n_data):
|
||||||
JSON_KEY_OR: x,
|
JSON_KEY_OR: x,
|
||||||
JSON_KEY_TR: translations.get(x, ""),
|
JSON_KEY_TR: translations.get(x, ""),
|
||||||
}
|
}
|
||||||
for x in set_
|
for x in sorted(set_)
|
||||||
]
|
]
|
||||||
|
|
||||||
result[JSON_KEY_TRANSL] = to_transl(tsl_items)
|
result[JSON_KEY_TRANSL] = to_transl(tsl_items)
|
||||||
result[JSON_KEY_UNTRANSL] = to_transl(new_items)
|
result[JSON_KEY_UNTRANSL] = to_transl(new_items)
|
||||||
result[JSON_KEY_OLDTRANSL] = to_transl(old_items)
|
result[JSON_KEY_OLDTRANSL] = to_transl(old_items)
|
||||||
|
|
||||||
json.dump(result, open(outputfilename, 'w'), sort_keys=True, indent=2)
|
json.dump(
|
||||||
|
result,
|
||||||
|
open(outputfilename, 'w'),
|
||||||
|
ensure_ascii=False,
|
||||||
|
indent="\t",
|
||||||
|
separators=(',', ': '),
|
||||||
|
sort_keys=True,
|
||||||
|
)
|
||||||
|
|
||||||
print(format(outputfilename, len(num_items), len(new_items), len(old_items)))
|
print(format(outputfilename, len(num_items), len(new_items), len(old_items)))
|
||||||
|
|
||||||
|
@ -96,4 +103,3 @@ if __name__ == '__main__':
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Failed on {0}, re-raising for traceback".format(filename))
|
print("Failed on {0}, re-raising for traceback".format(filename))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue