import re
from pathlib import Path
from collections import Counter

content = Path("frontend/src/lib/i18n.tsx").read_text(encoding="utf-8")

# Extract the en block (from "en: {" up to "\n  },\n  fr:")
m = re.search(r'en:\s*\{(.*?)\n\s*\},\s*\n\s*fr:', content, re.DOTALL)
if not m:
    print("Could not find en block")
    raise SystemExit(1)

en_block = m.group(1)
# Find all top-level keys in the en dictionary
keys = re.findall(r'"([a-zA-Z0-9_\-\.]+)":', en_block)
namespaces = Counter(k.split('.')[0] for k in keys)

for ns, count in namespaces.most_common():
    print(f"{ns}: {count}")
print(f"Total keys: {len(keys)}")
