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) <noreply@anthropic.com>
This commit is contained in:
@@ -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),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user