From 915783699b9f214ccd89ddab4f25707b844575ed Mon Sep 17 00:00:00 2001 From: Daan Date: Thu, 14 Nov 2024 21:36:27 +0100 Subject: [PATCH] Proposed changes --- src/static/locale/nl-nl.json | 2 +- src/static/locale/tr-tr.json | 2 +- src/static/locale/uk.json | 1 + src/static/locale/verify_locale_files.py | 66 ++++++++++++------------ 4 files changed, 37 insertions(+), 34 deletions(-) diff --git a/src/static/locale/nl-nl.json b/src/static/locale/nl-nl.json index 2565cd9..0193636 100644 --- a/src/static/locale/nl-nl.json +++ b/src/static/locale/nl-nl.json @@ -4,7 +4,7 @@ "Password": "Wachtwoord", "OTP from your authenticator": "OTP van uw authenticator", "Sign In": "Inloggen", - "Signing In...": "Inloggen...", + "Signing In\\.\\.\\.": "Inloggen...", "Access Remote Server": "Toegang tot Remote Server", "Server": "Server", "Click": "Klik", diff --git a/src/static/locale/tr-tr.json b/src/static/locale/tr-tr.json index e86c59d..f97d674 100644 --- a/src/static/locale/tr-tr.json +++ b/src/static/locale/tr-tr.json @@ -4,7 +4,7 @@ "Password": "Parola", "OTP from your authenticator": "Kimlik doğrulama uygulamanızdan tek kullanımlık parola", "Sign In": "Giriş Yap", - "Signing In...": "Giriş Yapılıyor...", + "Signing In\\.\\.\\.": "Giriş Yapılıyor...", "Access Remote Server": "Uzak Sunuculara Eriş", "Server": "Sunucu", "Click": "Tıkla", diff --git a/src/static/locale/uk.json b/src/static/locale/uk.json index f9530f7..ae257ee 100644 --- a/src/static/locale/uk.json +++ b/src/static/locale/uk.json @@ -236,6 +236,7 @@ "IP Address": "IP-адреса", "Enter IP Address / Hostname": "Введіть IP-адресу / ім’я хоста", "IP Address / Hostname": "IP-адресу / ім’я хоста", + "Dashboard IP Address \\& Listen Port": "", "Count": "Граф", "Geolocation": "", "Is Alive": "", diff --git a/src/static/locale/verify_locale_files.py b/src/static/locale/verify_locale_files.py index 55fed7a..0aa56be 100644 --- a/src/static/locale/verify_locale_files.py +++ b/src/static/locale/verify_locale_files.py @@ -15,36 +15,38 @@ print("Active Languages") status = {} -for k in range(len(active_languages)): - print(f"[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: - lang_file = json.loads(f.read()) - missing_translation = [] - deprecated_translation = [] +for language in active_languages: + print(f"[Language] {language['lang_name']}") - for a in language_template.keys(): - if a not in lang_file.keys(): - missing_translation.append(a) - - for b in lang_file.keys(): - if b not in language_template.keys(): - deprecated_translation.append(b) - - - print("\t[Missing Translations]") - 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") - - - print("\n\t[Deprecated Translations]") - 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 deprecated translations") - print() \ No newline at end of file + 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: + print(",\n".join(f'\t\t"{key}": ""' + for key in missing_translation)) + 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()