feat(i18n): add language-pack scaffold with English and Spanish

Introduces ``src/i18n`` with a tiny JSON-backed t() lookup, an in-session
language preference, and a sidebar selector wired through
``hide_streamlit_chrome`` so every page picks up the same picker. Covers
home, tool cards, findings panel, gate, shutdown, and pickup banner
strings. Tests pin pack parity and the farewell-overlay JS escape so
future packs can't silently regress.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-13 15:11:30 +00:00
parent 4706ed571e
commit c4ce86bd64
8 changed files with 649 additions and 75 deletions

View File

@@ -150,3 +150,20 @@ def display_name(tool_id: str) -> str:
"""Return the human-readable name; fall back to the id when unknown."""
t = tool_by_id(tool_id)
return t.name if t else tool_id
def tool_name(tool_id: str) -> str:
"""Return the localized tool name, falling back to the registry default."""
from src.i18n import t as _t
fallback = display_name(tool_id)
translated = _t(f"tools.{tool_id}.name")
return translated if translated != f"tools.{tool_id}.name" else fallback
def tool_description(tool_id: str) -> str:
"""Return the localized tool description, falling back to the registry default."""
from src.i18n import t as _t
tool = tool_by_id(tool_id)
fallback = tool.description if tool else ""
translated = _t(f"tools.{tool_id}.description")
return translated if translated != f"tools.{tool_id}.description" else fallback