From c24a2989fad0498063322474992b3f07fbaaf992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 12 Feb 2026 06:31:43 -0600 Subject: [PATCH] Fix locale redirection logic in LocaleRedirector.astro --- packages/website/src/components/LocaleRedirector.astro | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/website/src/components/LocaleRedirector.astro b/packages/website/src/components/LocaleRedirector.astro index b7ed9ce26..e74e20b22 100644 --- a/packages/website/src/components/LocaleRedirector.astro +++ b/packages/website/src/components/LocaleRedirector.astro @@ -14,12 +14,13 @@ if ( !isAPI && // not an api, duh! localStorage.getItem("preferred-locale") !== null && // no preference, so probably google's crawler - bestLocale !== currentPath?.locale // we need to redirect + ((bestLocale === locales.default && currentPath !== undefined) || + (bestLocale !== currentPath)) ) { window.location.pathname = isI18nPath ? window.location.pathname.replace( `/${currentPath?.locale}`, - bestLocale === undefined ? "" : `/${bestLocale}`, + bestLocale === locales.default ? "" : `/${bestLocale}`, ) : `${bestLocale}${window.location.pathname}`; }