diff --git a/autogen/check_languages.py b/autogen/check_languages.py index 22f1ef6cf..141b1d279 100644 --- a/autogen/check_languages.py +++ b/autogen/check_languages.py @@ -5,7 +5,7 @@ LANG_DIR = "./lang/" def pass_string(optionstr): return optionstr def open_lang(name): - parser = configparser.ConfigParser(interpolation=None) + parser = configparser.ConfigParser() parser.optionxform = pass_string parser.read(LANG_DIR + name, "utf-8") return parser diff --git a/tools/check_matching_langs.py b/tools/check_matching_langs.py index d0f855452..196515f31 100644 --- a/tools/check_matching_langs.py +++ b/tools/check_matching_langs.py @@ -1,22 +1,25 @@ import configparser import os +def pass_string(optionstr): return optionstr english = configparser.ConfigParser() -english.read("lang/English.ini", encoding="utf-8") +english.optionxform = pass_string +english.read("lang/English.ini", "utf-8") # get the sections and keys from the English INI file -english_sections = [section.upper() for section in english.sections()] +english_sections = english.sections() english_keys = { - section.upper(): [key.upper() for key in english.options(section)] + section: english.options(section) for section in english_sections } # function to compare an INI file against the English INI file def compare_ini_file(file_path): config = configparser.ConfigParser() - config.read(file_path, encoding="utf-8") + config.optionxform = pass_string + config.read(file_path, "utf-8") - config_sections = [section.upper() for section in config.sections()] + config_sections = config.sections() missing_sections = set(english_sections) - set(config_sections) extra_sections = set(config_sections) - set(english_sections) @@ -24,7 +27,7 @@ def compare_ini_file(file_path): missing_keys = {} for section in english_sections: if section in config_sections: - section_keys = [key.upper() for key in config.options(section)] + section_keys = config.options(section) missing_keys[section] = set(english_keys[section]) - set(section_keys) return missing_sections, extra_sections, missing_keys @@ -38,7 +41,7 @@ for filename in os.listdir("lang"): print(f"\nComparing {filename}:") if not missing_sections and not extra_sections and not any(missing_keys.values()): - print(f"{filename} is matching to English.ini.") + print(f"{filename}: matching!") else: if missing_sections: print(f"Missing sections: {', '.join(missing_sections)}") @@ -46,4 +49,4 @@ for filename in os.listdir("lang"): print(f"Extra sections: {', '.join(extra_sections)}") for section, keys in missing_keys.items(): if keys: - print(f"Missing keys in section '{section}': {', '.join(keys)}") \ No newline at end of file + print(f"[{section}]: Missing{', '.join(keys)}") \ No newline at end of file