new tool to check language files

a few revisions to the files themselves too:
- Added the `[LANGUAGE]:English` entry to the english language, its duty as the default language
- localized languages for the Spanish language
- Verified all entries in the Spanish language
This commit is contained in:
Cooliokid956 2026-03-27 13:05:51 -05:00
parent dfb3b2523d
commit 1c3c5fbb66
4 changed files with 91 additions and 10 deletions

View file

@ -5,3 +5,4 @@ python3 ./autogen/convert_structs.py $1
python3 ./autogen/gen_hooks.py $1
python3 ./autogen/convert_constants.py $1
python3 ./autogen/extract_display_lists.py $1
python3 ./autogen/check_languages.py $1

View file

@ -0,0 +1,78 @@
import os, configparser
LANG_DIR = "./lang/"
def pass_string(optionstr): return optionstr
def open_lang(name):
parser = configparser.ConfigParser(interpolation=None)
parser.optionxform = pass_string
parser.read(LANG_DIR + name)
return parser
DEF_NAME = "English.ini"
DEF_LANG = open_lang(DEF_NAME)
# Edit this dictionary when revising entries
verified_entries = {
"Spanish.ini": {
"MENU": ("NO"),
"CONTROLS": ("A", "B", "X", "Y", "Z", "L", "R", "CHAT", "START"),
"DISPLAY": ("MANUAL", "D0P5X", "D1X", "D1P5X", "D3X", "D10X", "D100X"),
"DJUI_THEMES": ("FONT_NORMAL", "MARIO_THEME", "ODYSSEY_THEME"),
"DYNOS": ("DYNOS"),
"HOST_MESSAGE": ("INFO_TITLE"),
"HOST_MODS": ("MODS"),
"HOST_MOD_CATEGORIES": ("ROMHACKS", "CHARACTER_SELECT"),
"HOST_SETTINGS": ("NORMAL"),
"HOST": ("DISCORD", "COOPNET", "MODS"),
"MENU_OPTIONS": ("MENU_TITLE"),
"MODLIST": ("MODS"),
}
}
for file in os.listdir(os.fsencode(LANG_DIR)):
filename = os.fsdecode(file)
if filename == DEF_NAME: continue
lang = open_lang(filename)
warned = False
for section in DEF_LANG.sections():
warnings = {
"UNTRANSLATED": [],
"MISSING": [],
"EXTRA": [],
}
if lang.has_section(section):
entries = list(dict.fromkeys(lang.options(section) + DEF_LANG.options(section)))
for entry in entries:
if lang.has_option(section, entry):
if not DEF_LANG.has_option(section, entry):
warnings["EXTRA"].append(entry)
continue
else:
warnings["MISSING"].append(entry)
continue
verified = verified_entries.get(filename)
if verified is not None:
verified = verified.get(section)
if verified is not None:
verified = entry in verified
if lang.get(section, entry) == DEF_LANG.get(section, entry) \
and not verified:
warnings["UNTRANSLATED"].append(entry)
else: warnings["MISSING"].append("SECTION")
if len(warnings["EXTRA"] + warnings["MISSING"] + warnings["UNTRANSLATED"]) > 0:
if not warned: warned = True; print(filename+":")
print(f"[{section}]")
for level, entries in warnings.items():
if len(entries) > 0:
print(level + ": " + ", ".join(entries))
print()

View file

@ -415,6 +415,7 @@ MUTE_FOCUS_LOSS = "Mute When Window Unfocused"
LANGUAGE = "LANGUAGE"
Czech = "Czech (Čeština)"
Dutch = "Dutch (Nederlands)"
English = "English"
French = "French (Français)"
German = "German (Deutsch)"
Italian = "Italian (Italiano)"

View file

@ -168,7 +168,7 @@ D10X = "10x"
D100X = "100x"
DRAW_DISTANCE = "Distancia de dibujado"
DYNOS_PACKS = "Packs DynOS"
ANTIALIASING = "Anti-aliasing"
ANTIALIASING = "Antialiasing"
OFF = "Desactivado"
MUST_RESTART = "Tienes que reiniciar el juego para aplicar los cambios."
SHOW_FPS = "Mostrar FPS"
@ -413,15 +413,16 @@ MUTE_FOCUS_LOSS = "Silenciar sonido cuando la ventana esté desenfocada"
[LANGUAGE]
LANGUAGE = "IDIOMA"
Czech = "Czech (Čeština)"
Dutch = "Dutch (Nederlands)"
French = "French (Français)"
German = "German (Deutsch)"
Italian = "Italian (Italiano)"
Japanese = "Japanese (日本語)"
Polish = "Polish (Polski)"
Portuguese = "Portuguese (Português)"
Russian = "Russian (Русский)"
Czech = "Checo (Čeština)"
Dutch = "Neerlandés (Nederlands)"
English = "Inglés (English)"
French = "Francés (Français)"
German = "Alemán (Deutsch)"
Italian = "Italiano (Italiano)"
Japanese = "Japonés (日本語)"
Polish = "Polaco (Polski)"
Portuguese = "Portugués (Português)"
Russian = "Ruso (Русский)"
Spanish = "Español"
[LOBBIES]