From 1c6727762537c03ec0847f7b60f31f819555c121 Mon Sep 17 00:00:00 2001 From: qarmin Date: Mon, 20 Dec 2021 07:00:16 +0100 Subject: [PATCH] Add script to check translations --- misc/translation_test.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 misc/translation_test.py diff --git a/misc/translation_test.py b/misc/translation_test.py new file mode 100644 index 0000000..af571cc --- /dev/null +++ b/misc/translation_test.py @@ -0,0 +1,34 @@ +translations = ["pl"] # en is missing here +base_translation = "en" + +base_keywords = [] +with open('i18n/' + base_translation + "/czkawka_gui.ftl", 'r') as file: + base_translation_file_content = file.readlines() + for line in base_translation_file_content: + if line.find("=") != -1: + first_split = line.split("=")[0].strip() + base_keywords.append(first_split) + + +for lang in translations: + print("\nChecking " + lang + " language") + lang_keywords = [] + with open('i18n/' + lang + "/czkawka_gui.ftl", 'r') as file: + file_content = file.readlines() + for line in file_content: + if line.find("=") != -1: + first_split = line.split("=")[0].strip() + lang_keywords.append(first_split) + + for keyword in base_keywords: + try: + lang_keywords.index(keyword) + except: + print("Missing keyword - " + keyword) + + for keyword in lang_keywords: + try: + base_keywords.index(keyword) + except: + print("Unused keyword - " + keyword) +