Files
Shiip-of-Hakinian-Espanol/scripts/auto_translate.py
nickpons666 77268dbf57
Some checks failed
generate-builds / generate-soh-otr (push) Has been cancelled
generate-builds / build-macos (push) Has been cancelled
generate-builds / build-linux (push) Has been cancelled
generate-builds / build-windows (push) Has been cancelled
Convert all remaining hardcoded text to LUS_LOC
- Replace 5 hardcoded text strings with LUS_LOC() calls:
  * ResolutionEditor.cpp: 'Click to resolve' -> BUTTON_CLICK_TO_RESOLVE
  * ResolutionEditor.cpp: ' ' (space) -> TEXT_SPACE
  * SohMenuNetwork.cpp: ':' (colon) -> TEXT_COLON (2 instances)
  * UIWidgets.cpp: '+' (plus) -> TEXT_PLUS
- Add new translation keys to both en_US.json and es_ES.json:
  * BUTTON_CLICK_TO_RESOLVE: 'Click to resolve' / 'Haz clic para resolver'
  * TEXT_SPACE: ' ' / ' '
  * TEXT_COLON: ':' / ':'
  * TEXT_PLUS: '+' / '+'
- All hardcoded UI text now uses localization system
- Compilation successful with only minor format warnings

This completes the immediate task of eliminating hardcoded text strings.
2026-03-28 16:32:42 -06:00

292 lines
10 KiB
Python

#!/usr/bin/env python3
import json
import re
from pathlib import Path
DICTIONARY = {
'enables': 'habilita',
'enables the': 'habilita la',
'enables the separate': 'habilita la ventana separada de',
'enables the separate': 'habilita la ventana',
'allows': 'permite',
'allows a': 'permite',
'allows the': 'permite',
'allows you to': 'te permite',
'allows pressing': 'permite presionar',
'allows multiple': 'permite múltiples',
'allows graves': 'permite las tumbas',
'allows equipping': 'permite equipar',
'allows link': 'permite a Link',
'allows link to': 'permite a Link',
'allows link to put': 'permite a Link guardar',
'allows link to enter': 'permite a Link entrar',
'allows link to unsheathe': 'permite a Link desenvainar',
'toggles': 'alterna',
'toggles the': 'alterna el',
'toggles fullscreen': 'alterna pantalla completa',
'toggles the input': 'alterna la entrada',
'changes the': 'cambia el',
'changes the scaling': 'cambia la escala',
'changes the menu': 'cambia el menú',
'changes the behavior': 'cambia el comportamiento',
'disable': 'deshabilitar',
'disables the': 'deshabilita el',
'disables the automatic': 'deshabilita el recentrado',
'disables the white': 'deshabilita la pantalla',
'disables the beating': 'deshabilita el latido',
'disables text': 'deshabilita el texto',
'disable the geometry': 'deshabilita la geometría',
'disable random': 'deshabilitar aleatorio',
'makes the cursor': 'hace que el cursor',
'makes all equipment': 'hace que todo el equipo',
'renders': 'renderiza',
'renders a': 'renderiza un',
'renders gauntlets': 'renderiza guantes',
'renders health': 'renderiza salud',
'advance': 'avanzar',
'advance 1 frame': 'avanzar 1 cuadro',
'advance frames': 'avanzar cuadros',
'matches': 'coincide',
'matches the': 'coincide con el',
'matches interpolation': 'coincide con la interpolación',
'matches the color': 'coincide con el color',
'removes': 'elimina',
'removes tearing': 'elimina el tearing',
'set': 'establecer',
'sets the': 'establece el',
'sets the applied': 'establece el filtro',
'sets the': 'establece',
'opens': 'abre',
'opens the folder': 'abre la carpeta',
'save': 'guardar',
'save mods': 'guardar mods',
'logs some': 'registra algunos',
'buffers your': 'almacena tus',
'buffers your inputs': 'almacena tus entradas',
'when': 'cuando',
'when obtaining': 'cuando obtienes',
'when the': 'cuando el',
'when you': 'cuando tú',
'when playing': 'cuando reproduces',
'when charged': 'cuando se carga',
'if enabled': 'si está habilitado',
'if you': 'si tú',
'if this': 'si esto',
'speeds': 'acelera',
'speeds up': 'acelera',
'speeds up lifting': 'acelera levantar',
'speeds up ship': 'acelera el barco',
'speeds up emptying': 'acelera el vaciado',
'speeds up animation': 'acelera la animación',
'skip': 'saltar',
'skip the': 'saltar el',
'skip pickup': 'saltar mensaje',
'skip the tower': 'saltar la torre',
'prevent': 'evitar',
'prevent forced': 'evitar forzar',
'prevent notifications': 'evitar notificaciones',
'adds': 'añade',
'adds a': 'añade un',
'adds back': 'vuelve a añadir',
'adds prompt': 'añade aviso',
'speak to': 'hablar con',
'speak to navi': 'hablar con Navi',
'holding down': 'mantener presionado',
'display': 'mostrar',
'displays a': 'muestra un',
'displays test': 'muestra prueba',
'with': 'con',
'with shuffle': 'con baraja',
'with shuffle speak': 'con baraja de voz',
'with the': 'con el',
'replace': 'reemplazar',
'replace navi': 'reemplazar Navi',
'creates': 'crea',
'creates a new': 'crea un nuevo',
'must be': 'debes estar',
'must be on': 'debes estar en',
'which corner': 'qué esquina',
'how long': 'cuánto tiempo',
'how opaque': 'qué tan opaco',
'how large': 'qué tan grande',
'adjust': 'ajustar',
'adjust the': 'ajustar el',
'custom': 'personalizado',
'custom graphics': 'gráficos personalizados',
'use custom': 'usar personalizado',
'the log level': 'el nivel de registro',
'the log': 'el registro',
'the actor': 'el actor',
'the collision': 'la colisión',
'the debug': 'la depuración',
'the enhanced': 'el mejorado',
'the separate': 'la ventana separada',
'the separate stats': 'la ventana de estadísticas',
'the separate console': 'la ventana de consola',
'the separate save': 'la ventana de guardado',
'the separate hook': 'la ventana de hooks',
'the separate collision': 'la ventana de colisiones',
'the separate actor': 'la ventana de actores',
'the separate message': 'la ventana de mensajes',
'the separate item': 'la ventana de objetos',
'the separate entrance': 'la ventana de entradas',
'the separate gfx': 'la ventana de gráficos',
'this is': 'esto es',
'this is not': 'esto no es',
'this button': 'este botón',
'this will': 'esto',
'show a': 'mostrar un',
'show notification': 'mostrar notificación',
'auto': 'auto',
'auto': 'automático',
'automatically': 'automáticamente',
'fast': 'rápido',
'fast text': 'texto rápido',
'fast putaway': 'guardado rápido',
'hide': 'ocultar',
'select': 'seleccionar',
'enter': 'entrar',
'drop': 'soltar',
'play': 'reproducir',
'load': 'cargar',
'restart': 'reiniciar',
'stop': 'detener',
'use': 'usar',
'randomizer': 'aleatorizador',
'randomizer settings': 'configuración del aleatorizador',
'item tracker': 'rastreador de objetos',
'entrance tracker': 'rastreador de entradas',
'check tracker': 'rastreador de comprobaciones',
'nighttime skulltulas': 'skulltulas nocturnas',
'scene reload': 'recarga de escena',
'pause menu': 'menú de pausa',
'target switching': 'cambio de objetivo',
'camera wiggle': 'oscilación de cámara',
'navi timer': 'temporizador de Navi',
'cutscene': 'escena',
'free cam': 'cámara libre',
'input viewer': 'visor de entradas',
'texture filtering': 'filtro de texturas',
'windowed fullscreen': 'pantalla completa en ventana',
'multiplies': 'multiplica',
'resolution': 'resolución',
'aspect ratio': 'relación de aspecto',
'anti-aliasing': 'antialiasing',
'vsync': 'vsync',
'fps': 'fps',
'geometry': 'geometría',
'camera': 'cámara',
'container': 'contenedor',
'dungeon': ' mazmorra',
'merchant': 'comerciante',
'gossip stone': 'piedra de rumores',
'chest': 'cofre',
'heart piece': 'pieza de corazón',
'skulltula': 'skulltula',
'rupee': 'rupia',
'magic': 'magia',
'health': 'salud',
'wallet': 'billetera',
'ocarina': 'ocarina',
'sword': 'espada',
'shield': 'escudo',
'tunic': 'túnica',
'boots': 'botas',
'hookshot': 'gancho',
'bomb': 'bomba',
'arrow': 'flecha',
'bottle': 'botella',
'key': 'llave',
'compass': 'brújula',
'map': 'mapa',
'boss key': 'llave de jefe',
'stone of agony': 'piedra de agonía',
'notification': 'notificación',
'sound': 'sonido',
'text to speech': 'texto a voz',
'forced conversation': 'conversación forzada',
'pickup message': 'mensaje de objeto',
'silver rock': 'roca de plata',
'obelisk': 'obelisco',
'shadow temple': 'templo de las sombras',
'first-person camera': 'cámara en primera persona',
'lock': 'bloquear',
'unlock': 'desbloquear',
'compatible': 'compatible',
'requires': 'requiere',
'required': 'requerido',
'reload': 'recargar',
'take effect': 'aplicar',
'test': 'prueba',
'corner': 'esquina',
'background': 'fondo',
'opacity': 'opacidad',
'scale': 'escala',
'factor': 'factor',
'pixel perfect': 'píxel perfecto',
'integer scaling': 'escala entera',
'controller': 'controlador',
'gamepad': 'mando',
'keyboard': 'teclado',
'mouse': 'ratón',
'd-pad': 'd-pad',
'button': 'botón',
'axis': 'eje',
'stick': 'stick',
'trigger': 'gatillo',
'deadzone': 'zona muerta',
'sensitivity': 'sensibilidad',
'gyro': 'giroscopio',
'rumble': 'vibración',
'led': 'led',
'calibrate': 'calibrar',
'threshold': 'umbral',
'notch': 'muesca',
'combine': 'combinar',
'port': 'puerto',
'clear': 'borrar',
'cancel': 'cancelar',
'apply': 'aplicar',
'reset': 'reiniciar',
'default': 'predeterminado',
'done': 'hecho',
'save file': 'archivo de guardado',
'spoiler file': 'archivo de spoiler',
'seed': 'semilla',
'logic': 'lógica',
'warp point': 'punto de teletransporte',
'entrance': 'entrada',
'exit': 'salida',
'file select': 'selección de archivo',
'debug warp screen': 'pantalla de teletransporte debug',
'time of day': 'hora del día',
}
def translate_text(text):
result = text.lower()
for eng, esp in DICTIONARY.items():
result = result.replace(eng, esp)
return result.capitalize() if result else result
def main():
es_file = Path('languages/es_ES.json')
es = json.load(open(es_file))
traducidas = 0
for k, v in es.items():
if v.startswith(('Enables', 'Allows', 'Toggles', 'Changes', 'Disable', 'Makes',
'Advance', 'Match', 'Remove', 'Set', 'Open', 'Save', 'Log',
'Buffer', 'When', 'If', 'Speeds', 'Skip', 'Prevent', 'Add',
'Speak', 'Hold', 'Display', 'With', 'Replace', 'Creates',
'Must', 'Which', 'How', 'Adjust', 'Custom', 'The ', 'This',
'Show', 'Render', 'Auto', 'Fast', 'Hide', 'Select', 'Enter',
'Drop', 'Play', 'Load', 'Restart', 'Stop', 'Use')):
es[k] = translate_text(v)
traducidas += 1
json.dump(es, open(es_file, 'w'), indent=4, ensure_ascii=False)
print(f'Traducciones automáticas añadidas: {traducidas}')
if __name__ == "__main__":
main()