- 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.
38 lines
861 B
Python
38 lines
861 B
Python
#!/usr/bin/env python3
|
|
import re
|
|
from pathlib import Path
|
|
|
|
PROJECT_ROOT = Path(__file__).parent.parent
|
|
SOH_DIR = PROJECT_ROOT / "soh" / "soh"
|
|
|
|
def fix_file(filepath):
|
|
with open(filepath, 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
original = content
|
|
|
|
# Corregir: LUS_LOC(""CLAVE"") -> LUS_LOC("CLAVE")
|
|
content = re.sub(
|
|
r'LUS_LOC\(""([^"]+)""\)',
|
|
r'LUS_LOC("\1")',
|
|
content
|
|
)
|
|
|
|
if content != original:
|
|
with open(filepath, 'w', encoding='utf-8') as f:
|
|
f.write(content)
|
|
return True
|
|
return False
|
|
|
|
def main():
|
|
fixed = 0
|
|
for cpp_file in SOH_DIR.rglob("*.cpp"):
|
|
if fix_file(cpp_file):
|
|
fixed += 1
|
|
print(f" Corregido: {cpp_file.name}")
|
|
|
|
print(f"\nArchivos corregidos: {fixed}")
|
|
|
|
if __name__ == "__main__":
|
|
main()
|