Files
uconsole_asw_game/tests/test_display_enums_i18n.py
T
Claude 27b17839d9 Translate raw state names on the uConsole and in the web client
Engine telegraph orders, the boat's battery phase, sonar fusion states and
TMA geometry were drawn as internal names (HALF, SUBMERGED, NUR BOW, KEINE);
the web showed sonar array, tow state, ROE, tube and weapon states raw, and
the mission editor showed field.placement.* / field.reach.* keys. All now
come from EN/DE catalog entries, with regression tests.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdXs5tkJ6kzdeubNWqPHtG
2026-09-27 11:00:17 +00:00

28 lines
1.2 KiB
Python

"""Engine orders and the boat's battery phase are shown translated, never as
their internal enum names (uConsole and web client)."""
from src.core import config
from src.core.i18n import DISPLAY_KEYS, get_translator, load_catalog
from src.enemies.endurance import PHASES
def test_every_telegraph_order_and_phase_has_a_label():
orders = ["ASTERN", *(name for name, _speed in config.TELEGRAPH_ORDERS)]
assert set(DISPLAY_KEYS["telegraph"]) == set(orders)
assert set(DISPLAY_KEYS["endurance_phase"]) == set(PHASES)
german = get_translator("de")
assert german.t(DISPLAY_KEYS["telegraph"]["HALF"]) != "HALF"
catalog = load_catalog("en")
for order in orders:
assert f"commander.web.telegraph_{order.lower()}" in catalog
for phase in PHASES:
assert f"commander.web.uboot_phase_{phase.lower()}" in catalog
def test_every_sonar_fusion_state_has_a_label():
for status in ("KEINE DATEN", "BESTAETIGT", "DIVERGENT / GEISTERKONTAKT?", "UNSICHER",
"NUR BOW", "NUR TOWED", "TAS L/R?", "TAS L/R? WENDE"):
assert status in DISPLAY_KEYS["fusion"], status
for geometry in ("KEINE", "BRAUCHBAR", "SCHWACH"):
assert geometry in DISPLAY_KEYS["tma"], geometry