mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
Merge branch 'main' into dev
This commit is contained in:
commit
b8c8528e1c
11 files changed
+161
-100
No files matched your search
@@ -7,18 +7,18 @@
|
||||
window.location.pathname.startsWith(`/${locale}`)
|
||||
);
|
||||
const bestLocale = getBestLocale();
|
||||
const currentPathLocale = locales.supported.find(({ locale }) =>
|
||||
const currentPath = locales.supported.find(({ locale }) =>
|
||||
window.location.pathname.startsWith(`/${locale}`)
|
||||
);
|
||||
|
||||
if (
|
||||
!isAPI && // not an api, duh!
|
||||
localStorage.getItem("preferred-locale") !== null && // no preference, so probably google's crawler
|
||||
bestLocale !== currentPathLocale // we need to redirect
|
||||
bestLocale !== currentPath?.locale // we need to redirect
|
||||
) {
|
||||
window.location.pathname = isI18nPath
|
||||
? window.location.pathname.replace(
|
||||
`/${currentPathLocale}`,
|
||||
`/${currentPath?.locale}`,
|
||||
bestLocale === undefined ? "" : `/${bestLocale}`
|
||||
)
|
||||
: `/${bestLocale}${window.location.pathname}`;
|
||||
|
||||
Reference in new issue
Block a user