From bd95705d7224ecf49b889b94ff65033925a09c10 Mon Sep 17 00:00:00 2001 From: Unchained Date: Tue, 24 Mar 2026 11:01:28 +0200 Subject: [PATCH] debug: add console logs to switchLocale --- src/components/layout/Header.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); };