Skip to content

Commit 644aad4

Browse files
authored
fix: configure fallback locales before server-side redirection (#3838)
1 parent 5cace7b commit 644aad4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/runtime/server/plugin.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ export default defineNitroPlugin(async nitro => {
146146
const options = await setupVueI18nOptions(getDefaultLocaleForDomain(getHost(event)) || _defaultLocale)
147147
const url = getRequestURL(event)
148148
const ctx = createI18nContext()
149+
150+
const localeConfigs = createLocaleConfigs(options.fallbackLocale)
151+
ctx.vueI18nOptions = options
152+
ctx.localeConfigs = localeConfigs
153+
149154
event.context.nuxtI18n = ctx
150155

151156
if (__I18N_SERVER_REDIRECT__) {
@@ -171,10 +176,6 @@ export default defineNitroPlugin(async nitro => {
171176
return
172177
}
173178
}
174-
175-
const localeConfigs = createLocaleConfigs(options.fallbackLocale)
176-
ctx.vueI18nOptions = options
177-
ctx.localeConfigs = localeConfigs
178179
})
179180

180181
nitro.hooks.hook('render:html', (htmlContext, { event }) => {

0 commit comments

Comments
 (0)