diff --git a/.gitignore b/.gitignore index 132a2a26..d3b153ad 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,4 @@ app/config/ docker/* !docker/docker-compose.yml lang_sort_log.txt +lang_sort.txt diff --git a/.gitlab/scripts/sort.py b/.gitlab/scripts/sort.py new file mode 100644 index 00000000..c78885a6 --- /dev/null +++ b/.gitlab/scripts/sort.py @@ -0,0 +1,72 @@ +import json +import os + + +def get_missing_keys_and_values(obj1, obj2, path=None): + if path is None: + path = [] + + missing_keys_and_values = {} + + if isinstance(obj1, dict) and isinstance(obj2, dict): + for key in obj1: + if key not in obj2: + missing_keys_and_values[key] = obj1[key] + elif isinstance(obj1[key], (dict, list)) and isinstance( + obj2[key], (dict, list) + ): + sub_missing = get_missing_keys_and_values( + obj1[key], obj2[key], path + [key] + ) + if sub_missing: + missing_keys_and_values[key] = sub_missing + + return missing_keys_and_values + + +def main(): + project_dir = os.getcwd() + os.chdir("../../app/translations") # Change the working directory + dir_path = os.getcwd() # Get the current working directory + + en_en_path = os.path.join(dir_path, "en_EN.json") + + if not os.path.isfile(en_en_path): + print( + f"The file en_EN.json does not exist in {dir_path}. Ensure you have the right directory, Exiting." + ) + return + + result = {} # JSON object to store missing keys and values + + for root, _, files in os.walk(dir_path): + for file in files: + if ( + "_incomplete" not in file + and file != "en_EN.json" + and file.endswith(".json") + ): + file_path = os.path.join(root, file) + + with open(file_path, "r", encoding="utf-8") as current_file: + current_data = json.load(current_file) + + with open(en_en_path, "r", encoding="utf-8") as en_en_file: + en_en_data = json.load(en_en_file) + + missing_keys_and_values = get_missing_keys_and_values( + en_en_data, current_data + ) + if missing_keys_and_values: + result[file] = missing_keys_and_values + + # Write the JSON object to lang_sort.txt + with open( + os.path.join(project_dir, "lang_sort.txt"), + "w", + encoding="utf-8", + ) as output_file: + json.dump(result, output_file, indent=4) + + +main() diff --git a/app/translations/en_EN.json b/app/translations/en_EN.json index 7c23f1ab..e1928d4e 100644 --- a/app/translations/en_EN.json +++ b/app/translations/en_EN.json @@ -588,6 +588,15 @@ "newServer": "Create New Server", "servers": "Servers" }, + "startup": { + "starting": "Crafty Is Starting...", + "serverInit": "Initializing Servers", + "server": "Initializing ", + "internet": "Checking for internet connection", + "tasks": "Starting Tasks Scheduler", + "internals": "Configuring and starting Crafty's internal components", + "almost": "Finishing up. Hang on tight..." + }, "userConfig": { "apiKey": "API Keys", "auth": "Authorized? ",