diff --git a/presenter/locales/extractLocale.ts b/presenter/locales/extractLocale.ts index dcd5e2c963..6c21d96dcb 100644 --- a/presenter/locales/extractLocale.ts +++ b/presenter/locales/extractLocale.ts @@ -6,7 +6,7 @@ export function extractLocale(url: string) { let urlWithoutLocale // We remove the URL locale, for example `/de/about` => `/about` const firstPath = urlPaths[1] as LocaleCode - if (locales.filter((locale) => locale !== localeDefault).includes(firstPath)) { + if (locales.includes(firstPath)) { locale = firstPath urlWithoutLocale = '/' + urlPaths.slice(2).join('/') } else { diff --git a/presenter/renderer/+onBeforeRoute.ts b/presenter/renderer/+onBeforeRoute.ts index cf119802f2..626930f25e 100644 --- a/presenter/renderer/+onBeforeRoute.ts +++ b/presenter/renderer/+onBeforeRoute.ts @@ -3,10 +3,6 @@ import { PageContext } from 'vike/types' import { extractLocale } from '#root/locales/extractLocale' export function onBeforeRoute(pageContext: PageContext) { - if (pageContext.urlPathname.endsWith('.js')) { - return { pageContext: { urlLogical: pageContext.urlPathname } } - } - const { urlWithoutLocale, locale } = extractLocale(pageContext.urlPathname) return { diff --git a/presenter/renderer/app.ts b/presenter/renderer/app.ts index 1d7f644019..c65279ac32 100644 --- a/presenter/renderer/app.ts +++ b/presenter/renderer/app.ts @@ -74,7 +74,7 @@ function createApp(pageContext: PageContext, isClient = true) { setPageContext(app, pageContextReactive) - if (pageContext.locale !== undefined && locales.includes(pageContext.locale)) { + if (pageContext.locale && locales.includes(pageContext.locale)) { i18n.global.locale.value = pageContext.locale } diff --git a/presenter/src/components/language/LanguageSelector.vue b/presenter/src/components/language/LanguageSelector.vue index 8e8c099d0c..ae196e29ce 100644 --- a/presenter/src/components/language/LanguageSelector.vue +++ b/presenter/src/components/language/LanguageSelector.vue @@ -1,6 +1,6 @@