mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Add script to remove stale i18n strings
This commit is contained in:
parent
059f52667e
commit
a353ad7677
1 changed files with 19 additions and 0 deletions
19
tests/remove_stale_string.py
Normal file
19
tests/remove_stale_string.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import re
|
||||||
|
import json
|
||||||
|
import glob
|
||||||
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
locale_folder = "../locales/"
|
||||||
|
locale_files = glob.glob(locale_folder + "*.json")
|
||||||
|
locale_files = [filename.split("/")[-1] for filename in locale_files]
|
||||||
|
locale_files.remove("en.json")
|
||||||
|
|
||||||
|
reference = json.loads(open(locale_folder + "en.json").read())
|
||||||
|
|
||||||
|
for locale_file in locale_files:
|
||||||
|
|
||||||
|
print(locale_file)
|
||||||
|
this_locale = json.loads(open(locale_folder + locale_file).read(), object_pairs_hook=OrderedDict)
|
||||||
|
this_locale_fixed = {k:v for k, v in this_locale.items() if k in reference}
|
||||||
|
|
||||||
|
json.dump(this_locale_fixed, open(locale_folder + locale_file, "w"), indent=4, ensure_ascii=False)
|
Loading…
Add table
Reference in a new issue