mirror of
https://github.com/db9979/uconsole_asw_game.git
synced 2026-12-06 12:54:18 +01:00
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
25 lines
916 B
Python
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)
|