1
0
mirror of https://github.com/donaldzou/WGDashboard.git synced 2024-11-22 07:10:09 +01:00

Update verify_locale_files.py

This commit is contained in:
Donald Zou 2024-11-15 02:15:40 +08:00
parent 665b0f1484
commit 43f6bd41c9

View File

@ -13,53 +13,38 @@ print("="*(len(welcome) + 4))
print() print()
print("Active Languages") print("Active Languages")
for al in range(len(active_languages)): status = {}
print(f"\t[Language #{al + 1}] {active_languages[al]['lang_name']}")
k = -1 for k in range(len(active_languages)):
print(f"[Language] {active_languages[k]['lang_name']}")
m = input("Select the language number you want to verify or enter [q] to exit: ") if active_languages[k]['lang_id'] != "en":
if m != "q": with open(f"{active_languages[k]['lang_id']}.json", "r") as f:
if m.isdigit(): lang_file = json.loads(f.read())
k = int(m) - 1 missing_translation = []
if k < 0 or k > len(active_languages): deprecated_translation = []
exit(0)
else: for a in language_template.keys():
exit(0) if a not in lang_file.keys():
else: missing_translation.append(a)
exit(0)
for b in lang_file.keys():
if b not in language_template.keys():
print() deprecated_translation.append(b)
print(f"Selected Language: {active_languages[k]['lang_name']}")
if active_languages[k]['lang_id'] != "en":
with open(f"{active_languages[k]['lang_id']}.json", "r") as f: print("\t[Missing Translations]")
if len(missing_translation) > 0:
lang_file = json.loads(f.read()) for a in range(len(missing_translation)):
missing_translation = [] print(f'\t\t"{missing_translation[a]}": ""{(',' if a < len(missing_translation) - 1 else '')}')
deprecated_translation = [] else:
print("\t\tNo missing translations")
for a in language_template.keys():
if a not in lang_file.keys():
missing_translation.append(a) print("\n\t[Deprecated Translations]")
if len(deprecated_translation) > 0:
for b in lang_file.keys(): for a in range(len(deprecated_translation)):
if b not in language_template.keys(): print(f'\t\t"{deprecated_translation[a]}": "{lang_file[deprecated_translation[a]]}"')
deprecated_translation.append(b)
else:
print("\t\tNo deprecated translations")
print("\n\t[Missing Translations] Simply copy the JSON below into the locale file and translate them in :)") print()
if len(missing_translation) > 0:
for a in range(len(missing_translation)):
print(f'\t\t"{missing_translation[a]}": ""{(',' if a < len(missing_translation) - 1 else '')}')
else:
print("\t\tNo missing translations ;) You're all good!")
print("\n\t[Deprecated Translations] Simply remove the translation below :)1")
if len(deprecated_translation) > 0:
for a in range(len(deprecated_translation)):
print(f'\t\t"{deprecated_translation[a]}": "{lang_file[deprecated_translation[a]]}"')
else:
print("\t\tNo deprecated9 translations ;) You're all good!")