mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-25 03:29:51 +01: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 (
|
if (
|
||||||
!isAPI && // not an api, duh!
|
!isAPI && // not an api, duh!
|
||||||
localStorage.getItem("preferred-locale") !== null && // no preference, so probably google's crawler
|
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 = isI18nPath
|
||||||
? window.location.pathname.replace(
|
? window.location.pathname.replace(
|
||||||
`/${currentPath?.locale}`,
|
`/${currentPath?.locale}`,
|
||||||
bestLocale === undefined ? "" : `/${bestLocale}`,
|
bestLocale === locales.default ? "" : `/${bestLocale}`,
|
||||||
)
|
)
|
||||||
: `${bestLocale}${window.location.pathname}`;
|
: `${bestLocale}${window.location.pathname}`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user