From 42d7f1ca67356aea56d512928133e83707550037 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sat, 3 Dec 2022 10:49:26 +0100 Subject: [PATCH] lang: Allow langtool to update invalid translation fields --- dist/langtool.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dist/langtool.py b/dist/langtool.py index 6e043148a..906332686 100644 --- a/dist/langtool.py +++ b/dist/langtool.py @@ -3,6 +3,7 @@ import sys import json DEFAULT_LANG = "en_US" +INVALID_TRANSLATION = "***** MISSING TRANSLATION *****" def handle_missing_key(command, lang_data, key, value): @@ -14,7 +15,7 @@ def handle_missing_key(command, lang_data, key, value): new_value = input("Enter translation: ") lang_data["translations"][key] = new_value elif command == "update": - lang_data["translations"][key] = "***** MISSING TRANSLATION *****" + lang_data["translations"][key] = INVALID_TRANSLATION def main(): @@ -82,7 +83,7 @@ def main(): additional_lang_data = json.load(additional_lang_file) for key, value in default_lang_data["translations"].items(): - if key not in additional_lang_data["translations"]: + if key not in additional_lang_data["translations"] or additional_lang_data["translations"][key] == INVALID_TRANSLATION: handle_missing_key(command, additional_lang_data, key, value) keys_to_remove = []