1
0
mirror of synced 2025-01-18 09:04:52 +01:00

lang: Allow langtool to update invalid translation fields

This commit is contained in:
WerWolv 2022-12-03 10:49:26 +01:00
parent cf51e04777
commit 42d7f1ca67

5
dist/langtool.py vendored
View File

@ -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 = []