2024-11-14 02:02:26 +08:00
|
|
|
import json
|
|
|
|
import os.path
|
|
|
|
|
|
|
|
from typing_extensions import deprecated
|
|
|
|
|
|
|
|
active_languages = json.loads(open("active_languages.json", "r").read())
|
|
|
|
language_template = json.loads(open("language_template.json", "r").read())
|
|
|
|
welcome = "WGDashboard Locale File Verification [by @donaldzou]"
|
|
|
|
|
|
|
|
print("="*(len(welcome) + 4))
|
|
|
|
print(f"| {welcome} |")
|
|
|
|
print("="*(len(welcome) + 4))
|
|
|
|
print()
|
|
|
|
print("Active Languages")
|
|
|
|
|
2024-11-15 02:15:40 +08:00
|
|
|
status = {}
|
|
|
|
|
2024-11-14 21:36:27 +01:00
|
|
|
for language in active_languages:
|
|
|
|
print(f"[Language] {language['lang_name']}")
|
2024-11-15 02:15:40 +08:00
|
|
|
|
2024-11-14 21:36:27 +01:00
|
|
|
if language['lang_id'] != "en":
|
|
|
|
with open(f"{language['lang_id']}.json", "r") as f:
|
|
|
|
lang_file = json.load(f)
|
|
|
|
|
|
|
|
# Identify missing and deprecated translations
|
|
|
|
missing_translation = [
|
|
|
|
key for key in language_template
|
|
|
|
if key not in lang_file or not lang_file[key].strip()
|
|
|
|
]
|
|
|
|
|
|
|
|
deprecated_translation = [
|
|
|
|
key for key in lang_file
|
|
|
|
if key not in language_template
|
|
|
|
]
|
|
|
|
|
|
|
|
# Print missing translations
|
|
|
|
print("\t[Missing Translations]")
|
|
|
|
if missing_translation:
|
2024-11-17 17:20:41 +08:00
|
|
|
print(",\n".join(f'\t\t"' + key + '": ""' for key in missing_translation))
|
2024-11-14 21:36:27 +01:00
|
|
|
else:
|
|
|
|
print("\t\tNo missing translations")
|
|
|
|
|
|
|
|
# Print deprecated translations
|
|
|
|
print("\n\t[Deprecated Translations]")
|
|
|
|
if deprecated_translation:
|
|
|
|
print("\n".join(f'\t\t"{key}": "{lang_file[key]}"'
|
|
|
|
for key in deprecated_translation))
|
|
|
|
else:
|
|
|
|
print("\t\tNo deprecated translations")
|
|
|
|
|
|
|
|
print()
|