diff --git a/frontend/src/components/language-switcher.tsx b/frontend/src/components/language-switcher.tsx index d0d9e41..7929227 100644 --- a/frontend/src/components/language-switcher.tsx +++ b/frontend/src/components/language-switcher.tsx @@ -24,7 +24,7 @@ export function LanguageSwitcher() { return ( - @@ -33,8 +33,11 @@ export function LanguageSwitcher() { {locales.map((l) => ( setLocale(l.code)} - className="flex items-center gap-2 cursor-pointer" + onClick={() => { + console.log(`[LanguageSwitcher] Clicking ${l.code}`); + setLocale(l.code); + }} + className="flex items-center gap-2 cursor-pointer focus:outline-none focus:bg-accent focus:text-accent-foreground" > {l.flag} {l.name} diff --git a/frontend/src/lib/i18n.tsx b/frontend/src/lib/i18n.tsx index 5d4bed1..993a3c1 100644 --- a/frontend/src/lib/i18n.tsx +++ b/frontend/src/lib/i18n.tsx @@ -39,7 +39,12 @@ const getInitialLocale = (): Locale => { }; export function I18nProvider({ children }: { children: ReactNode }) { - const [locale, setLocale] = useState(getInitialLocale); + const [locale, setLocaleState] = useState(getInitialLocale); + + const setLocale = (newLocale: Locale) => { + console.log(`[I18n] Setting locale to: ${newLocale}`); + setLocaleState(newLocale); + }; const t = useCallback((key: string, params?: Record): string => { const keys = key.split('.');