1e51ef7def
- Konzept/, didaktik_geografie/, didaktik_simulation/, v2-modules/, v2-platform/ - 12 code-workspace-Files - STATUS-*.md - viele M/D/R-Änderungen an bereits getrackten Files - .gitignore verstärkt: **/.humaninput/, **/secret_keys.txt Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
38 lines
1.5 KiB
Python
38 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Stellt 'Vereinigtes Königreich' auf 'Großbritannien' um — in cities.json
|
|
(Bus + Flug) inklusive aller Quiz-Choices. Schulisch ist 'Großbritannien'
|
|
das vertrautere Wort fuer Sek I. Politisch waere 'Vereinigtes Koenigreich'
|
|
korrekter (UK = Grossbritannien + Nordirland), aber fuer die Sim ist
|
|
Lesbarkeit wichtiger. Glossar 'eu-aussengrenze' behaelt 'Vereinigtes
|
|
Koenigreich' wegen Brexit-Kontext.
|
|
"""
|
|
import json
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[3] # App/
|
|
TARGETS = [
|
|
ROOT / "sims" / "busfahrt" / "assets" / "data" / "cities.json",
|
|
ROOT / "sims" / "fluggesellschaft" / "assets" / "data" / "cities.json",
|
|
]
|
|
OLD = "Vereinigtes Königreich"
|
|
NEW = "Großbritannien"
|
|
|
|
for path in TARGETS:
|
|
if not path.exists():
|
|
print(f"skip: {path} (nicht vorhanden)"); continue
|
|
with path.open(encoding="utf-8") as f:
|
|
cities = json.load(f)
|
|
changed = 0
|
|
for c in cities:
|
|
if c.get("country") == OLD:
|
|
c["country"] = NEW; changed += 1
|
|
# auch in Quiz-Choices ersetzen
|
|
for qkey in ("question", "questionContinent"):
|
|
q = c.get(qkey)
|
|
if q and isinstance(q.get("choices"), list):
|
|
q["choices"] = [NEW if x == OLD else x for x in q["choices"]]
|
|
with path.open("w", encoding="utf-8") as f:
|
|
json.dump(cities, f, ensure_ascii=False, indent=2); f.write("\n")
|
|
print(f"{path.name}: {changed} country-Felder umbenannt + alle Choices gepatcht.")
|