N
Nuxtβ€’2mo ago
Dovendyret

I18n configuration server-side

Hello πŸ™‚ I have a app with the nuxt-i18n module and different domains. I have a server route for verifying emails: /verify-email In this server-route I'm calling an external backend which requires a locale parameter, so I need to figure which language corresponds to the incoming request host. The app runs in a few different environments which have their domains specified by .env variables. Preferably I would like to get access to the current i18n configuration in my server/route. Does anyone have any idea how I could achieve that? Thank you πŸ™
1 Reply
Dovendyret
Dovendyretβ€’2mo ago
I ended up including the i18n configurations in runtimeConfig. Not sure if it's the most optimal way of doing it but it works for my purpose:
export default defineNuxtConfig({
i18n: require('./nuxt.i18n.config'),

runtimeConfig: {
i18n: require('./nuxt.i18n.config'),
},
})
export default defineNuxtConfig({
i18n: require('./nuxt.i18n.config'),

runtimeConfig: {
i18n: require('./nuxt.i18n.config'),
},
})