diff --git a/src/components/layout/Header.tsx b/src/components/layout/Header.tsx index 7a8c9d2..48b6b5e 100644 --- a/src/components/layout/Header.tsx +++ b/src/components/layout/Header.tsx @@ -48,10 +48,13 @@ export default function Header({ locale = "sr" }: HeaderProps) { setLangDropdownOpen(false); return; } + console.log("Switching from", locale, "to", newLocale); + console.log("Current pathname:", pathname); document.cookie = `NEXT_LOCALE=${newLocale}; path=/; max-age=31536000`; const pathWithoutLocale = pathname.replace(/^\/(sr|en|de|fr)/, "") || "/"; const newPath = `/${newLocale}${pathWithoutLocale}`; - window.location.href = newPath; + console.log("Navigating to:", newPath); + window.location.replace(newPath); setLangDropdownOpen(false); };