From 183069d87fbec0f05af17a517412eac321cf02d7 Mon Sep 17 00:00:00 2001 From: argenis de la rosa Date: Mon, 9 Mar 2026 16:48:07 -0400 Subject: [PATCH] fix(web): make sidebar navigation items reactive to locale changes The sidebar was using t() which references a module-level currentLocale variable that doesn't trigger re-renders when the locale changes. Updated to use the LocaleContext and tLocale() so sidebar navigation items update immediately when the user selects a different language. Co-Authored-By: Claude Opus 4.6 --- web/src/components/layout/Sidebar.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/src/components/layout/Sidebar.tsx b/web/src/components/layout/Sidebar.tsx index 57740c80a..e3d3f8a94 100644 --- a/web/src/components/layout/Sidebar.tsx +++ b/web/src/components/layout/Sidebar.tsx @@ -14,7 +14,8 @@ import { Stethoscope, X, } from 'lucide-react'; -import { t } from '@/lib/i18n'; +import { tLocale } from '@/lib/i18n'; +import { useLocaleContext } from '@/App'; const COLLAPSE_BUTTON_DELAY_MS = 1000; @@ -45,6 +46,9 @@ export default function Sidebar({ onToggleCollapse, }: SidebarProps) { const [showCollapseButton, setShowCollapseButton] = useState(false); + const { locale } = useLocaleContext(); + + const t = (key: string) => tLocale(key, locale); useEffect(() => { const id = setTimeout(() => setShowCollapseButton(true), COLLAPSE_BUTTON_DELAY_MS);