From d9ea426c792b463cc0884a0a19ff45c9b5ae4d12 Mon Sep 17 00:00:00 2001 From: Dante291 Date: Fri, 29 Dec 2023 23:53:57 +0530 Subject: [PATCH 01/19] Verification of Translation Comparison Script Functionality --- lang/de.json | 1 - lang/en.json | 7 ------- lang/es.json | 2 -- lang/fr.json | 4 ---- lang/ja.json | 3 --- lang/zh.json | 3 +-- 6 files changed, 1 insertion(+), 19 deletions(-) diff --git a/lang/de.json b/lang/de.json index d903796ca..740a2fb83 100644 --- a/lang/de.json +++ b/lang/de.json @@ -152,7 +152,6 @@ "Logout": "Ausloggen", "Settings": "Einstellungen", "Dark Theme": "Dunkles Thema", - "Error": "Fout", "Warning": "Waarschuwing", "Information": "Informatie", diff --git a/lang/en.json b/lang/en.json index 09bdd9211..c7cf4c0b7 100644 --- a/lang/en.json +++ b/lang/en.json @@ -12,7 +12,6 @@ "Enter your password": "Enter your password", "Forgot password": "Forgot password", "Login": "Login", - "Notification Feature is not installed": "Notification Feature is not installed", "Sit back relax, we'll": "Sit back relax, we'll", "Recover": "Recover", @@ -35,7 +34,6 @@ "Next": "Next", "Request Sent to": "Request Sent to", "Log out": "Log out", - "Error": "Error", "Warning": "Warning", "Information": "Information", @@ -46,7 +44,6 @@ "Collaborate": "Collaborate", "with your": "with your", "Organizations": "Organizations", - "Title from the viewMode GSoC branch": "Title from the viewMode GSoC branch", "Please verify URL first": "Please verify URL first", "Enter a valid URL": "Enter a valid URL", @@ -61,20 +58,16 @@ "Password must not contain spaces": "Password must not contain spaces", "Password does not match original": "Password does not match original", "Join Organisation": "Join Organisation", - "We're": "We're", "Glad": "Glad", "you're": "you're", "Back": "Back", - "Let's": "Let's", "get": "get", "you": "you", "SignUp": "SignUp", - "Please wait": "Please wait", "for organisation(s) to accept your invitation.": "for organisation(s) to accept your invitation.", - "Add Event Title": "Add Event Title", "Where is the event": "Where is the event", "Add Location": "Add Location", diff --git a/lang/es.json b/lang/es.json index d1060a09b..9401739d4 100644 --- a/lang/es.json +++ b/lang/es.json @@ -14,9 +14,7 @@ "Login": "Acceso", "Sit back relax, we'll": "Siéntese, ", "Recover": "", - "Notification Feature is not installed": "La función de notificación no está instalada", - "your password": "relájese, recuperaremos su contraseña", "Recover Password": "Recupera tu contraseña", "Select Language": "Seleccione el idioma", diff --git a/lang/fr.json b/lang/fr.json index 6db60cd06..8bea3b769 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -7,10 +7,8 @@ "Enter new password": "Entrez un nouveau mot de passe", "Re-Enter your password": "Entrez à nouveau votre mot de passe", "Change Password": "Changer le mot de passe", - "Email Hint": "test@test.org", "Notification Feature is not installed": "La fonction de notification n'est pas installée", - "Enter your registered Email": "Entrez votre email enregistré", "Enter your password": "Tapez votre mot de passe", "Forgot password": "Mot de passe oublié", @@ -36,7 +34,6 @@ "Next": "Suivante", "Request Sent to": "Demande envoyée à", "Log out": "Se déconnecter", - "Join": "Rejoignez", "and": "et", "Collaborate": "collaborez", @@ -61,7 +58,6 @@ "Password must not contain spaces": "Le mot de passe ne doit pas contenir d'espaces", "Password does not match original": "Le mot de passe ne correspond pas à l'original", "Join Organisation": "Rejoindre l'organisation", - "We're": "Nous sommes", "Glad": "heureux que vous", "you're": "soyez de", diff --git a/lang/ja.json b/lang/ja.json index 98b00fe3f..22953de4f 100644 --- a/lang/ja.json +++ b/lang/ja.json @@ -14,7 +14,6 @@ "Login": "ログイン", "Sit back relax, we'll": "ゆったりとおくつろぎください。", "Recover": "回復", - "Notification Feature is not installed": "通知機能がインストールされていません", "your password": "あなたのパスワード", "Recover Password": "パスワードを回復", @@ -62,10 +61,8 @@ "get": "得る", "you": "あなた", "SignUp": "サインアップ", - "Please wait": "お待ちください", "for organisation(s) to accept your invitation.": "組織があなたの招待を受け入れるために。", - "Add Event Title": "イベントタイトルを追加", "Where is the event": "イベントはどこですか", "Add Location": "場所を追加", diff --git a/lang/zh.json b/lang/zh.json index ef0a20487..a1fbbb55b 100644 --- a/lang/zh.json +++ b/lang/zh.json @@ -15,7 +15,6 @@ "Sit back relax, we'll": "高枕无忧, ", "Recover": "", "Notification Feature is not installed": "未安装通知功能\n", - "your password": "我们会找回您的密码", "Recover Password": "恢复你的密码", "Select Language": "选择语言", @@ -164,5 +163,5 @@ " join an organization.": " 加入一个组织。", "JOIN":"加入", "Camera": "相机", - "Gallery": "画廊" + "Galler": "画廊" } From b9c2da4279cb42354469b3c250587a55b3d2714c Mon Sep 17 00:00:00 2001 From: Dante291 Date: Sat, 30 Dec 2023 00:05:04 +0530 Subject: [PATCH 02/19] testing when default language has 1 extra key --- lang/en.json | 2 +- lang/zh.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lang/en.json b/lang/en.json index c7cf4c0b7..010193a99 100644 --- a/lang/en.json +++ b/lang/en.json @@ -163,5 +163,5 @@ " join an organization.": " join an organization.", "JOIN":"JOIN", "Camera": "Camera", - "Gallery": "Gallery" + "Galler": "Gallery" } diff --git a/lang/zh.json b/lang/zh.json index a1fbbb55b..3f587f4cf 100644 --- a/lang/zh.json +++ b/lang/zh.json @@ -163,5 +163,5 @@ " join an organization.": " 加入一个组织。", "JOIN":"加入", "Camera": "相机", - "Galler": "画廊" + "Gallery": "画廊" } From cd9492f23bbfd091648bc59f394a25f2cacead46 Mon Sep 17 00:00:00 2001 From: Dante291 Date: Sat, 30 Dec 2023 00:05:28 +0530 Subject: [PATCH 03/19] testing when default language has 1 extra key --- lang/en.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lang/en.json b/lang/en.json index 010193a99..0a7a513c3 100644 --- a/lang/en.json +++ b/lang/en.json @@ -163,5 +163,6 @@ " join an organization.": " join an organization.", "JOIN":"JOIN", "Camera": "Camera", - "Galler": "Gallery" + "Gallery": "Gallery", + "Parag":"Parag" } From dcb86866e66a68b12f8b4698e36fe71d18c8e74a Mon Sep 17 00:00:00 2001 From: Dante291 Date: Sat, 30 Dec 2023 00:10:23 +0530 Subject: [PATCH 04/19] testing when key in DL has different spacing in a key --- lang/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/en.json b/lang/en.json index 0a7a513c3..7e1d586a1 100644 --- a/lang/en.json +++ b/lang/en.json @@ -160,7 +160,7 @@ "Dark Theme": "Dark Theme", "No organizations found Please contact your admin": "No organizations found ! Please contact your admin", "For complete access, please": "For complete access, please", - " join an organization.": " join an organization.", + "join an organization.": " join an organization.", "JOIN":"JOIN", "Camera": "Camera", "Gallery": "Gallery", From fcf069d23cc7eace667be61a43acde1fdbfd7c9a Mon Sep 17 00:00:00 2001 From: Dante291 Date: Sat, 30 Dec 2023 00:20:25 +0530 Subject: [PATCH 05/19] testing multiple extra keys in DL --- lang/en.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lang/en.json b/lang/en.json index 7e1d586a1..b1ea74809 100644 --- a/lang/en.json +++ b/lang/en.json @@ -160,9 +160,11 @@ "Dark Theme": "Dark Theme", "No organizations found Please contact your admin": "No organizations found ! Please contact your admin", "For complete access, please": "For complete access, please", - "join an organization.": " join an organization.", + " join an organization.": " join an organization.", "JOIN":"JOIN", "Camera": "Camera", "Gallery": "Gallery", - "Parag":"Parag" + "Parag":"Parag", + "Parag1":"Parag", + "Para21":"Parag" } From 21e862210805b03c5a4afafe3bebccefccf792b7 Mon Sep 17 00:00:00 2001 From: Dante291 Date: Sat, 30 Dec 2023 00:30:30 +0530 Subject: [PATCH 06/19] testing when key is wrong in other translation files --- lang/de.json | 2 +- lang/en.json | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lang/de.json b/lang/de.json index 740a2fb83..016ce9ce3 100644 --- a/lang/de.json +++ b/lang/de.json @@ -144,7 +144,7 @@ "Switched to": "Gewechselt zu", "Organisation already joined": "Organisation bereits beigetreten", "Membership request already sent": "Mitgliedsantrag bereits gesendet", - "Select one organization to continue": "Wählen Sie eine Organisation aus, um fortzufahren", + "Select one organization to continu": "Wählen Sie eine Organisation aus, um fortzufahren", "SomeThing went wrong": "Etwas ist schief gelaufen", "Join in request sent to": "Beitrittsanfrage gesendet an", "successfully": "erfolgreich", diff --git a/lang/en.json b/lang/en.json index b1ea74809..c7cf4c0b7 100644 --- a/lang/en.json +++ b/lang/en.json @@ -163,8 +163,5 @@ " join an organization.": " join an organization.", "JOIN":"JOIN", "Camera": "Camera", - "Gallery": "Gallery", - "Parag":"Parag", - "Parag1":"Parag", - "Para21":"Parag" + "Gallery": "Gallery" } From 13a84efc7bef36af519ec1806edc0580fbf91856 Mon Sep 17 00:00:00 2001 From: Dante291 Date: Sat, 30 Dec 2023 00:42:23 +0530 Subject: [PATCH 07/19] Modifying script to give more detailed description for the missing or mismatched key --- .github/workflows/compare_translations.py | 45 ++++++++++------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/.github/workflows/compare_translations.py b/.github/workflows/compare_translations.py index 384f25e28..c623ec868 100644 --- a/.github/workflows/compare_translations.py +++ b/.github/workflows/compare_translations.py @@ -59,22 +59,24 @@ def compare_translations(default_translation, other_translation): - """Compare two translations and print missing keys. + """Compare two translations and return detailed info about missing/mismatched keys. Args: - default_translation: The default translation - other_translation: The other translation + default_translation (dict): The default translation. + other_translation (dict): The other translation. Returns: - missing_translations: List of missing translations + list: A list of detailed error messages for each missing/mismatched key. """ - missing_translations = [] + errors = [] for key in default_translation: if key not in other_translation: - missing_translations.append(key) + error_msg = f"Missing/Mismatched Key: '{key}' - This key is missing in the non-default translation file." + errors.append(error_msg) + + return errors - return missing_translations def load_translation(filepath): @@ -95,7 +97,7 @@ def load_translation(filepath): def check_translations(directory): """Load default translation and compare with other translations. - Args: + Args: directory (str): The directory containing translation files. Returns: @@ -106,28 +108,21 @@ def check_translations(directory): translations = os.listdir(translations_dir) translations.remove("en.json") # Exclude default translation - files_with_missing_translations = [] + error_found = False for translation_file in translations: translation_path = os.path.join(translations_dir, translation_file) other_translation = load_translation(translation_path) - # Compare translations - missing_translations = compare_translations( - default_translation, other_translation - ) - if missing_translations: - file_translation = FileTranslation(translation_file, missing_translations) - files_with_missing_translations.append(file_translation) - - for file_translation in files_with_missing_translations: - print( - f"File {translations_dir}/{file_translation.file} has missing translations for:" - ) - for key in file_translation.missing_translations: - print(f" - {key}") - - if files_with_missing_translations: + # Compare translations and get detailed error messages + errors = compare_translations(default_translation, other_translation) + if errors: + error_found = True + print(f"Error in file: {translation_path}") + for error in errors: + print(f" - {error}") + + if error_found: sys.exit(1) # Exit with an error status code else: print("All translations are present") From ad5f22a3a4063de2ac79e1982fcc3a37d94d16af Mon Sep 17 00:00:00 2001 From: Dante291 Date: Sat, 30 Dec 2023 00:43:13 +0530 Subject: [PATCH 08/19] testing --- lang/zh.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/zh.json b/lang/zh.json index 3f587f4cf..a1fbbb55b 100644 --- a/lang/zh.json +++ b/lang/zh.json @@ -163,5 +163,5 @@ " join an organization.": " 加入一个组织。", "JOIN":"加入", "Camera": "相机", - "Gallery": "画廊" + "Galler": "画廊" } From 1a650d4906b4b01bd523d4d6a8d434ad5b39c2c1 Mon Sep 17 00:00:00 2001 From: Dante291 Date: Sat, 30 Dec 2023 00:59:56 +0530 Subject: [PATCH 09/19] testing --- .github/workflows/compare_translations.py | 26 +++++++++++++++-------- lang/pt.json | 4 +--- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/compare_translations.py b/.github/workflows/compare_translations.py index c623ec868..9a3a1f1dc 100644 --- a/.github/workflows/compare_translations.py +++ b/.github/workflows/compare_translations.py @@ -58,12 +58,14 @@ FileTranslation = namedtuple("FileTranslation", ["file", "missing_translations"]) -def compare_translations(default_translation, other_translation): +def compare_translations(default_translation, other_translation, default_file, other_file): """Compare two translations and return detailed info about missing/mismatched keys. Args: - default_translation (dict): The default translation. - other_translation (dict): The other translation. + default_translation (dict): The default translation (en.json). + other_translation (dict): The other language translation. + default_file (str): The name of the default translation file. + other_file (str): The name of the other translation file. Returns: list: A list of detailed error messages for each missing/mismatched key. @@ -72,7 +74,13 @@ def compare_translations(default_translation, other_translation): for key in default_translation: if key not in other_translation: - error_msg = f"Missing/Mismatched Key: '{key}' - This key is missing in the non-default translation file." + error_msg = f"Missing Key in '{other_file}': '{key}' - This key from '{default_file}' is missing." + errors.append(error_msg) + + # Check for keys in other_translation that don't match any in default_translation + for key in other_translation: + if key not in default_translation: + error_msg = f"Error Key in '{other_file}': '{key}' - This key does not match any key in '{default_file}'." errors.append(error_msg) return errors @@ -103,7 +111,8 @@ def check_translations(directory): Returns: None """ - default_translation = load_translation("lang/en.json") + default_file = "lang/en.json" + default_translation = load_translation(default_file) translations_dir = directory translations = os.listdir(translations_dir) translations.remove("en.json") # Exclude default translation @@ -111,14 +120,13 @@ def check_translations(directory): error_found = False for translation_file in translations: - translation_path = os.path.join(translations_dir, translation_file) - other_translation = load_translation(translation_path) + other_file = os.path.join(translations_dir, translation_file) + other_translation = load_translation(other_file) # Compare translations and get detailed error messages - errors = compare_translations(default_translation, other_translation) + errors = compare_translations(default_translation, other_translation, default_file, other_file) if errors: error_found = True - print(f"Error in file: {translation_path}") for error in errors: print(f" - {error}") diff --git a/lang/pt.json b/lang/pt.json index 1bd61aad6..56131e106 100644 --- a/lang/pt.json +++ b/lang/pt.json @@ -13,9 +13,7 @@ "Forgot password": "Esqueceu sua senha", "Login": "Conecte-se", "Sit back relax, we'll": "Sente-se relaxe, vamos", - "Notification Feature is not installed": "O recurso de notificação não está instalado", - "Recover": "Recuperar", "your password": "sua senha", "Recover Password": "Recuperar senha", @@ -165,5 +163,5 @@ " join an organization.": " ingressar em uma organização.", "JOIN":"ENTRAR", "Camera": "Câmera", - "Gallery": "Galeria" + "Galler": "Galeria" } From e97373b378ee724f00bf41b640b2a91d25eaf54f Mon Sep 17 00:00:00 2001 From: Dante291 Date: Sat, 30 Dec 2023 01:05:20 +0530 Subject: [PATCH 10/19] testing --- .github/workflows/compare_translations.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compare_translations.py b/.github/workflows/compare_translations.py index 9a3a1f1dc..8fe6e8273 100644 --- a/.github/workflows/compare_translations.py +++ b/.github/workflows/compare_translations.py @@ -72,21 +72,23 @@ def compare_translations(default_translation, other_translation, default_file, o """ errors = [] + # Check for missing keys in other_translation for key in default_translation: if key not in other_translation: - error_msg = f"Missing Key in '{other_file}': '{key}' - This key from '{default_file}' is missing." + error_msg = f"Missing Key: '{key}' - This key from '{default_file}' is missing in '{other_file}'." errors.append(error_msg) # Check for keys in other_translation that don't match any in default_translation for key in other_translation: if key not in default_translation: - error_msg = f"Error Key in '{other_file}': '{key}' - This key does not match any key in '{default_file}'." + error_msg = f"Error Key: '{key}' - This key in '{other_file}' does not match any key in '{default_file}'." errors.append(error_msg) return errors + def load_translation(filepath): """Load translation from a file. From 3ae8536ae68c0b34a31aa8cb7ec879ee1b6b1c48 Mon Sep 17 00:00:00 2001 From: Dante291 Date: Sat, 30 Dec 2023 01:07:59 +0530 Subject: [PATCH 11/19] testing --- .github/workflows/compare_translations.py | 65 +++++++++++------------ 1 file changed, 30 insertions(+), 35 deletions(-) diff --git a/.github/workflows/compare_translations.py b/.github/workflows/compare_translations.py index 8fe6e8273..384f25e28 100644 --- a/.github/workflows/compare_translations.py +++ b/.github/workflows/compare_translations.py @@ -58,35 +58,23 @@ FileTranslation = namedtuple("FileTranslation", ["file", "missing_translations"]) -def compare_translations(default_translation, other_translation, default_file, other_file): - """Compare two translations and return detailed info about missing/mismatched keys. +def compare_translations(default_translation, other_translation): + """Compare two translations and print missing keys. Args: - default_translation (dict): The default translation (en.json). - other_translation (dict): The other language translation. - default_file (str): The name of the default translation file. - other_file (str): The name of the other translation file. + default_translation: The default translation + other_translation: The other translation Returns: - list: A list of detailed error messages for each missing/mismatched key. + missing_translations: List of missing translations """ - errors = [] + missing_translations = [] - # Check for missing keys in other_translation for key in default_translation: if key not in other_translation: - error_msg = f"Missing Key: '{key}' - This key from '{default_file}' is missing in '{other_file}'." - errors.append(error_msg) - - # Check for keys in other_translation that don't match any in default_translation - for key in other_translation: - if key not in default_translation: - error_msg = f"Error Key: '{key}' - This key in '{other_file}' does not match any key in '{default_file}'." - errors.append(error_msg) - - return errors - + missing_translations.append(key) + return missing_translations def load_translation(filepath): @@ -107,32 +95,39 @@ def load_translation(filepath): def check_translations(directory): """Load default translation and compare with other translations. - Args: + Args: directory (str): The directory containing translation files. Returns: None """ - default_file = "lang/en.json" - default_translation = load_translation(default_file) + default_translation = load_translation("lang/en.json") translations_dir = directory translations = os.listdir(translations_dir) translations.remove("en.json") # Exclude default translation - error_found = False + files_with_missing_translations = [] for translation_file in translations: - other_file = os.path.join(translations_dir, translation_file) - other_translation = load_translation(other_file) - - # Compare translations and get detailed error messages - errors = compare_translations(default_translation, other_translation, default_file, other_file) - if errors: - error_found = True - for error in errors: - print(f" - {error}") - - if error_found: + translation_path = os.path.join(translations_dir, translation_file) + other_translation = load_translation(translation_path) + + # Compare translations + missing_translations = compare_translations( + default_translation, other_translation + ) + if missing_translations: + file_translation = FileTranslation(translation_file, missing_translations) + files_with_missing_translations.append(file_translation) + + for file_translation in files_with_missing_translations: + print( + f"File {translations_dir}/{file_translation.file} has missing translations for:" + ) + for key in file_translation.missing_translations: + print(f" - {key}") + + if files_with_missing_translations: sys.exit(1) # Exit with an error status code else: print("All translations are present") From 40c725faca11ad01e209d9b7368a49b7c0a6ab35 Mon Sep 17 00:00:00 2001 From: Dante291 Date: Sat, 30 Dec 2023 01:13:42 +0530 Subject: [PATCH 12/19] more detailed description for error --- .github/workflows/compare_translations.py | 38 ++++++++++------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/.github/workflows/compare_translations.py b/.github/workflows/compare_translations.py index 384f25e28..00666c6c3 100644 --- a/.github/workflows/compare_translations.py +++ b/.github/workflows/compare_translations.py @@ -95,39 +95,33 @@ def load_translation(filepath): def check_translations(directory): """Load default translation and compare with other translations. - Args: + Args: directory (str): The directory containing translation files. Returns: None """ - default_translation = load_translation("lang/en.json") + default_file = "lang/en.json" + default_translation = load_translation(default_file) translations_dir = directory translations = os.listdir(translations_dir) translations.remove("en.json") # Exclude default translation - files_with_missing_translations = [] + error_found = False for translation_file in translations: - translation_path = os.path.join(translations_dir, translation_file) - other_translation = load_translation(translation_path) - - # Compare translations - missing_translations = compare_translations( - default_translation, other_translation - ) - if missing_translations: - file_translation = FileTranslation(translation_file, missing_translations) - files_with_missing_translations.append(file_translation) - - for file_translation in files_with_missing_translations: - print( - f"File {translations_dir}/{file_translation.file} has missing translations for:" - ) - for key in file_translation.missing_translations: - print(f" - {key}") - - if files_with_missing_translations: + other_file = os.path.join(translations_dir, translation_file) + other_translation = load_translation(other_file) + + # Compare translations and get detailed error messages + errors = compare_translations(default_translation, other_translation, default_file, other_file) + if errors: + error_found = True + print(f"File {other_file} has missing translations for:") + for error in errors: + print(f" - {error}") + + if error_found: sys.exit(1) # Exit with an error status code else: print("All translations are present") From f0e2b5ffd12b45e16476cd9f0ba9402a8c518afb Mon Sep 17 00:00:00 2001 From: Dante291 Date: Sat, 30 Dec 2023 01:17:03 +0530 Subject: [PATCH 13/19] testing --- .github/workflows/compare_translations.py | 28 ++++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/compare_translations.py b/.github/workflows/compare_translations.py index 00666c6c3..447b0deff 100644 --- a/.github/workflows/compare_translations.py +++ b/.github/workflows/compare_translations.py @@ -58,23 +58,35 @@ FileTranslation = namedtuple("FileTranslation", ["file", "missing_translations"]) -def compare_translations(default_translation, other_translation): - """Compare two translations and print missing keys. +def compare_translations(default_translation, other_translation, default_file, other_file): + """Compare two translations and return detailed info about missing/mismatched keys. Args: - default_translation: The default translation - other_translation: The other translation + default_translation (dict): The default translation (en.json). + other_translation (dict): The other language translation. + default_file (str): The name of the default translation file. + other_file (str): The name of the other translation file. Returns: - missing_translations: List of missing translations + list: A list of detailed error messages for each missing/mismatched key. """ - missing_translations = [] + errors = [] + # Check for missing keys in other_translation for key in default_translation: if key not in other_translation: - missing_translations.append(key) + error_msg = f"Missing Key: '{key}' - This key from '{default_file}' is missing in '{other_file}'." + errors.append(error_msg) + + # Check for keys in other_translation that don't match any in default_translation + for key in other_translation: + if key not in default_translation: + error_msg = f"Error Key: '{key}' - This key in '{other_file}' does not match any key in '{default_file}'." + errors.append(error_msg) + + return errors + - return missing_translations def load_translation(filepath): From d8f44ebb0b6942dcfbc65a8789fddf1283b27e47 Mon Sep 17 00:00:00 2001 From: Dante291 Date: Sat, 30 Dec 2023 01:22:55 +0530 Subject: [PATCH 14/19] testing if new script displays the correct error for new key that is not present in non default files --- lang/de.json | 2 +- lang/en.json | 3 ++- lang/pt.json | 2 +- lang/zh.json | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lang/de.json b/lang/de.json index 016ce9ce3..740a2fb83 100644 --- a/lang/de.json +++ b/lang/de.json @@ -144,7 +144,7 @@ "Switched to": "Gewechselt zu", "Organisation already joined": "Organisation bereits beigetreten", "Membership request already sent": "Mitgliedsantrag bereits gesendet", - "Select one organization to continu": "Wählen Sie eine Organisation aus, um fortzufahren", + "Select one organization to continue": "Wählen Sie eine Organisation aus, um fortzufahren", "SomeThing went wrong": "Etwas ist schief gelaufen", "Join in request sent to": "Beitrittsanfrage gesendet an", "successfully": "erfolgreich", diff --git a/lang/en.json b/lang/en.json index c7cf4c0b7..0a7a513c3 100644 --- a/lang/en.json +++ b/lang/en.json @@ -163,5 +163,6 @@ " join an organization.": " join an organization.", "JOIN":"JOIN", "Camera": "Camera", - "Gallery": "Gallery" + "Gallery": "Gallery", + "Parag":"Parag" } diff --git a/lang/pt.json b/lang/pt.json index 56131e106..1dafd483f 100644 --- a/lang/pt.json +++ b/lang/pt.json @@ -163,5 +163,5 @@ " join an organization.": " ingressar em uma organização.", "JOIN":"ENTRAR", "Camera": "Câmera", - "Galler": "Galeria" + "Gallery": "Galeria" } diff --git a/lang/zh.json b/lang/zh.json index a1fbbb55b..3f587f4cf 100644 --- a/lang/zh.json +++ b/lang/zh.json @@ -163,5 +163,5 @@ " join an organization.": " 加入一个组织。", "JOIN":"加入", "Camera": "相机", - "Galler": "画廊" + "Gallery": "画廊" } From a475ae6c0ea2f7d9ec09023509570dd0db7b975c Mon Sep 17 00:00:00 2001 From: Dante291 Date: Sat, 30 Dec 2023 01:25:45 +0530 Subject: [PATCH 15/19] testing for wrong key in non default --- lang/es.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/es.json b/lang/es.json index 9401739d4..7379d15a3 100644 --- a/lang/es.json +++ b/lang/es.json @@ -163,5 +163,5 @@ " join an organization.": " unirse a una organización.", "JOIN":"UNIRSE", "Camera": "Cámara", - "Gallery": "Galería" + "Galler": "Galería" } From 4ee90428b50583a99f5e77435482b820c1a23065 Mon Sep 17 00:00:00 2001 From: Dante291 Date: Sat, 30 Dec 2023 01:30:20 +0530 Subject: [PATCH 16/19] modified compare translation script --- .github/workflows/compare_translations.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/compare_translations.py b/.github/workflows/compare_translations.py index 447b0deff..d8c0aff79 100644 --- a/.github/workflows/compare_translations.py +++ b/.github/workflows/compare_translations.py @@ -113,23 +113,22 @@ def check_translations(directory): Returns: None """ - default_file = "lang/en.json" - default_translation = load_translation(default_file) - translations_dir = directory - translations = os.listdir(translations_dir) - translations.remove("en.json") # Exclude default translation + default_file = "en.json" + default_translation = load_translation(os.path.join(directory, default_file)) + translations = os.listdir(directory) + translations.remove(default_file) # Exclude default translation error_found = False for translation_file in translations: - other_file = os.path.join(translations_dir, translation_file) + other_file = os.path.join(directory, translation_file) other_translation = load_translation(other_file) # Compare translations and get detailed error messages - errors = compare_translations(default_translation, other_translation, default_file, other_file) + errors = compare_translations(default_translation, other_translation, default_file, translation_file) if errors: error_found = True - print(f"File {other_file} has missing translations for:") + print(f"File {translation_file} has missing translations for:") for error in errors: print(f" - {error}") From 381cf350b87b055c088962e5e2a25cbbae40e34d Mon Sep 17 00:00:00 2001 From: Dante291 Date: Sat, 30 Dec 2023 01:34:58 +0530 Subject: [PATCH 17/19] testing --- lang/de.json | 2 +- lang/es.json | 2 +- lang/pt.json | 2 +- lang/zh.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lang/de.json b/lang/de.json index 740a2fb83..016ce9ce3 100644 --- a/lang/de.json +++ b/lang/de.json @@ -144,7 +144,7 @@ "Switched to": "Gewechselt zu", "Organisation already joined": "Organisation bereits beigetreten", "Membership request already sent": "Mitgliedsantrag bereits gesendet", - "Select one organization to continue": "Wählen Sie eine Organisation aus, um fortzufahren", + "Select one organization to continu": "Wählen Sie eine Organisation aus, um fortzufahren", "SomeThing went wrong": "Etwas ist schief gelaufen", "Join in request sent to": "Beitrittsanfrage gesendet an", "successfully": "erfolgreich", diff --git a/lang/es.json b/lang/es.json index 7379d15a3..9401739d4 100644 --- a/lang/es.json +++ b/lang/es.json @@ -163,5 +163,5 @@ " join an organization.": " unirse a una organización.", "JOIN":"UNIRSE", "Camera": "Cámara", - "Galler": "Galería" + "Gallery": "Galería" } diff --git a/lang/pt.json b/lang/pt.json index 1dafd483f..56131e106 100644 --- a/lang/pt.json +++ b/lang/pt.json @@ -163,5 +163,5 @@ " join an organization.": " ingressar em uma organização.", "JOIN":"ENTRAR", "Camera": "Câmera", - "Gallery": "Galeria" + "Galler": "Galeria" } diff --git a/lang/zh.json b/lang/zh.json index 3f587f4cf..a1fbbb55b 100644 --- a/lang/zh.json +++ b/lang/zh.json @@ -163,5 +163,5 @@ " join an organization.": " 加入一个组织。", "JOIN":"加入", "Camera": "相机", - "Gallery": "画廊" + "Galler": "画廊" } From 1c12f605b10c145d2a1edb9b0086d7e6dbf6c0f7 Mon Sep 17 00:00:00 2001 From: Dante291 Date: Sat, 30 Dec 2023 01:37:06 +0530 Subject: [PATCH 18/19] testing --- lang/en.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lang/en.json b/lang/en.json index 0a7a513c3..c7cf4c0b7 100644 --- a/lang/en.json +++ b/lang/en.json @@ -163,6 +163,5 @@ " join an organization.": " join an organization.", "JOIN":"JOIN", "Camera": "Camera", - "Gallery": "Gallery", - "Parag":"Parag" + "Gallery": "Gallery" } From e91bc6293d30e1a28d38ae029536d1dbcf0db2c3 Mon Sep 17 00:00:00 2001 From: Dante291 Date: Sat, 30 Dec 2023 01:40:16 +0530 Subject: [PATCH 19/19] modified --- lang/de.json | 2 +- lang/pt.json | 2 +- lang/zh.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lang/de.json b/lang/de.json index 016ce9ce3..740a2fb83 100644 --- a/lang/de.json +++ b/lang/de.json @@ -144,7 +144,7 @@ "Switched to": "Gewechselt zu", "Organisation already joined": "Organisation bereits beigetreten", "Membership request already sent": "Mitgliedsantrag bereits gesendet", - "Select one organization to continu": "Wählen Sie eine Organisation aus, um fortzufahren", + "Select one organization to continue": "Wählen Sie eine Organisation aus, um fortzufahren", "SomeThing went wrong": "Etwas ist schief gelaufen", "Join in request sent to": "Beitrittsanfrage gesendet an", "successfully": "erfolgreich", diff --git a/lang/pt.json b/lang/pt.json index 56131e106..1dafd483f 100644 --- a/lang/pt.json +++ b/lang/pt.json @@ -163,5 +163,5 @@ " join an organization.": " ingressar em uma organização.", "JOIN":"ENTRAR", "Camera": "Câmera", - "Galler": "Galeria" + "Gallery": "Galeria" } diff --git a/lang/zh.json b/lang/zh.json index a1fbbb55b..3f587f4cf 100644 --- a/lang/zh.json +++ b/lang/zh.json @@ -163,5 +163,5 @@ " join an organization.": " 加入一个组织。", "JOIN":"加入", "Camera": "相机", - "Galler": "画廊" + "Gallery": "画廊" }