#!/usr/bin/env python3 """Validate language-pack content and emit the same-shaped bundle used by UI QA. Rust build.rs performs the actual compile-time discovery and embedding. """ from pathlib import Path import argparse import json import re ROOT = Path(__file__).resolve().parents[1] def bundle(root=ROOT): languages=[];locales=set() for path in sorted((root/'langs').glob('*.json')): assert re.fullmatch(r'[A-Za-z0-9_-]{1,64}',path.stem),path assert path.stat().st_size<=262144,path pack=json.loads(path.read_text(encoding='utf-8'));assert set(pack)=={'meta','translations'},f'unexpected top-level language-pack keys: {set(pack)-{"meta","translations"}} in {path}';meta=pack['meta'];translations=pack['translations'] assert all(isinstance(meta.get(key),str) and 0