Files
uconsole_asw_game/tests/test_scenario_texts.py
T
Claude 5e91871707 Translate the double hunt's loss line in the scenario menu
The menu showed the raw key "scenario.double.lose" because the catalog
had no entry for it. Adds it in English and German and a test that every
scenario goal/loss line the menu draws is in both catalogs.

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

25 lines
916 B
Python

"""Every scenario text the menu shows has a catalog entry in both languages."""
import json
from pathlib import Path
from src.core import config
ROOT = Path(__file__).resolve().parents[1]
KEYS = {"s1_patrouille": "patrol", "s2_doppeljagd": "double",
"s3_abfang": "intercept", "s4_zufall": "random"}
def test_menu_goal_and_loss_lines_are_translated():
catalogs = [json.loads((ROOT / f"data/i18n/{lang}.json").read_text(encoding="utf-8"))
for lang in ("en", "de")]
assert set(KEYS) == set(config.SCENARIOS)
for scenario, name in KEYS.items():
spec = config.SCENARIOS[scenario]
wanted = ["title", "brief"]
wanted += ["win"] if spec["win_text"] else []
wanted += ["lose"] if spec["lose_text"] else []
for field in wanted:
for catalog in catalogs:
assert f"scenario.{name}.{field}" in catalog, (scenario, field)