feat: remove redundant /en

This commit is contained in:
tresabhi committed 2025-01-10 20:38:28 -06:00
1 parent e4558d978c
commit cb3e759f75
2 files changed
+15 -3

No files matched your search

+12 -2
View File
@@ -46,9 +46,19 @@ const isRoot = pathname === '/';
window.location.pathname.startsWith(`/${locale}`),
);
const bestLocale = getBestLocale();
const currentPathLocale = SUPPORTED_LOCALES.find((locale) =>
window.location.pathname.startsWith(`/${locale}`),
);
if (!isI18nPath && bestLocale !== undefined) {
window.location.pathname = `/${bestLocale}${window.location.pathname}`;
console.log(bestLocale);
if (bestLocale !== currentPathLocale) {
window.location.pathname = isI18nPath
? window.location.pathname.replace(
`/${currentPathLocale}`,
bestLocale === undefined ? '' : `/${bestLocale}`,
)
: `/${bestLocale}${window.location.pathname}`;
}
</script>
</head>