mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
Fix locale redirection logic in LocaleRedirector.astro
This commit is contained in:
1 parent
a6cfb522b3
commit
c24a2989fa
1 file changed
+3
-2
@@ -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}`;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user