From 175389219f255707b5b58be27eb8d61cf27478b1 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 16 May 2026 20:19:15 +0000 Subject: [PATCH] fix(gui): translate sidebar tool names when language changes The sidebar nav was passing ``tool.name`` (the registry's English field) to ``st.Page``, so the tool entries stayed in English even after the user picked Spanish from the language selector. Section headers were already i18n-driven; tool entries were not. Switch to ``tool_name(tool_id)`` which routes through ``t(...)`` and picks up the active language from session state. Verified: with ``ui_lang=es`` the sidebar renders Buscar duplicados / Limpiar texto / Mapear columnas / etc. instead of the English fallbacks. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/gui/app.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/app.py b/src/gui/app.py index bc6b00d..50028bb 100644 --- a/src/gui/app.py +++ b/src/gui/app.py @@ -148,7 +148,7 @@ def _home_page() -> None: # the entries; an empty-string key suppresses the header so the Home # entry sits at the top without a label above it. -from src.gui.tools_registry import TOOLS, section_label # noqa: E402 +from src.gui.tools_registry import TOOLS, section_label, tool_name # noqa: E402 from src.i18n import t as _t # noqa: E402 @@ -167,13 +167,16 @@ def _build_navigation() -> dict[str, list]: "transformations": [], "automations": [], } + # Resolve the tool name through ``tool_name`` (i18n lookup) instead + # of using the registry's English ``tool.name`` field, otherwise the + # sidebar stays in English when the user switches to Spanish. for tool in TOOLS: by_section[tool.section].append( _page_for( tool.tool_id, page_slug=tool.page_slug, icon=tool.icon, - title=tool.name, + title=tool_name(tool.tool_id), ) )