N
Nuxt4mo ago
fabkho

i18n lazy loading | rollup bundles all language files

I have a basic i18n setup with lazy loading enabled just like described here: https://i18n.nuxtjs.org/docs/guide/lazy-load-translations
i18n: {
locales: [
{
code: 'en',
file: 'en-US.json',
},
{
code: 'es',
file: 'es-ES.json',
},
{
code: 'fr',
file: 'fr-FR.json',
},
],
lazy: true,
langDir: 'lang',
defaultLocale: 'en',
compilation: {
strictMessage: false,
},
},
i18n: {
locales: [
{
code: 'en',
file: 'en-US.json',
},
{
code: 'es',
file: 'es-ES.json',
},
{
code: 'fr',
file: 'fr-FR.json',
},
],
lazy: true,
langDir: 'lang',
defaultLocale: 'en',
compilation: {
strictMessage: false,
},
},
Lazy loading seems to work. I can see that on locale change the needed language is requested. But if i look into my client bundle with nuxi analyze, all language files are bundled. I would expect that only my default language file is bundled initially. In this example this is not a problem but in my real world application i have 10 language files + 10 shared language files coming from my layer (which are btw also bundled separately instead of merged, not ideal too)
@nuxtjs/i18n
Lazy-load translations
How to lazy-load translations.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server