nuxt3
nuxt3 copied to clipboard
[Bug] Not working `vueI18n.locale` options
Project info:
------------------------------
- Operating System: `Windows_NT`
- Node Version: `v17.7.2`
- Nuxt Version: `3.0.0-27460489.53fbca7`
- Package Manager: `[email protected]`
- Builder: `vite`
- User Config: `buildModules`, `intlify`
- Runtime Modules: `-`
- Build Modules: `@intlify/[email protected]`
------------------------------
Config:
// https://v3.nuxtjs.org/docs/directory-structure/nuxt.config
export default defineNuxtConfig({
buildModules: ['@intlify/nuxt3'],
intlify: {
vueI18n: {
localeDir: 'locales',
vueI18n: {
locale: 'en-US',
fallbackLocale: 'en-US',
}
}
}
})
Console log: [intlify] Not found 'meta.title' key in 'en' locale messages.
@dungsil seems you are missing vueI18n.locales with translations
@razbakov The file locales/en-US.yml exists.
@dungsil what's the content of that file? Does it have key "meta.title"? Try to rename that file to en.yml
@razbakov If I do that, it works, but not i want that's solution. In the README it is marked as mutable and I want this config to work.
https://github.com/intlify/nuxt3/blob/2df57f672135fdc9bea0f7d11234e1b064e1f666/README.md?plain=1#L67-L85
@dungsil Concerning en-US.yml and en.yml check languages of your browser. I guess i18n module takes the preferred language of your browser.
Please elaborate on your last question. I don't understand the problem. I thought your initial question was about error [intlify] Not found 'meta.title' key in 'en' locale messages..
How is mutable connected to that context?
@razbakov
A value of ko or ko-KR must be used to work as the browser's default locale. (in my case)
My guess is that this value is probably used as is, not overwritten.
https://github.com/intlify/nuxt3/blob/2df57f672135fdc9bea0f7d11234e1b064e1f666/packages/nuxt3/src/runtime/plugin.ts#L26-L31
I am submitting an issue in the nature of a bug report and not a question.
As the title suggests, the vueI18n.locale option does not work.
The option key localeDir should be outside vueI18n, at the root of intlifyactually.
export default defineNuxtConfig({
buildModules: ['@intlify/nuxt3'],
intlify: {
localeDir: 'locales',
vueI18n: {
locale: 'en-US',
fallbackLocale: 'en-US',
}
}
})