Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n key not found in locale messages #80

Open
AasmundN opened this issue Aug 6, 2023 · 7 comments
Open

i18n key not found in locale messages #80

AasmundN opened this issue Aug 6, 2023 · 7 comments

Comments

@AasmundN
Copy link

AasmundN commented Aug 6, 2023

After following documentation for basic setup of i18n with lazy loading of locales from files, I get this error on the initial render:

[intlify] Not found 'welcome' key in 'en' locale messages.

Reproduction:

https://stackblitz.com/edit/github-6zjd6y?file=app.vue,nuxt.config.ts,package.json,lang%2Fen-US.json,i18n.config.ts

Is this a bug, or am I just doing something wrong? I have checked the playground, and things seem to be working there, but I can't figure out what is different there vs my code.

@userquin
Copy link
Owner

userquin commented Aug 7, 2023

To access message using Vuetify $t you need to prefix the key with $vuetify.: $t('$vuetify.welcome')

@AasmundN
Copy link
Author

AasmundN commented Aug 7, 2023

Hm, that didn't seem to do anything. It doesn't seem to work without vuetify-nuxt-module either, so must be something wrong with @nuxtjs/i18n? https://stackblitz.com/edit/github-coadyf?file=i18n.config.ts,nuxt.config.ts,app.vue,lang%2Fes-ES.json,package.json

Spomething to do with this maybe? nuxt-modules/i18n#2192

@userquin
Copy link
Owner

userquin commented Aug 7, 2023

i18n module version? I'll try to figure out what's happening...

@AasmundN
Copy link
Author

AasmundN commented Aug 7, 2023

Using rc 2. Have also tried beta 13, with no luck. Thanks 🙏

@userquin
Copy link
Owner

userquin commented Aug 7, 2023

@AasmundN It is weird, your repro working, check my fork here: https://stackblitz.com/edit/github-6zjd6y-eqyxxp?file=.npmrc

I've only change the package manager adding .npmrc

@AasmundN
Copy link
Author

AasmundN commented Aug 7, 2023

Hmm, yes your fork works. Weird. Maybe it's some sort of problem with npm? However, when I add another locale and corresponding file and then set that as the default locale it stops working again: https://stackblitz.com/edit/github-6zjd6y-axgyjt?file=i18n.config.ts,app.vue

I get an error in the console: [Vue warn]: Hydration text mismatch

And if I don't set the second locale as the default one, the second locale is not loaded properly: https://stackblitz.com/edit/github-6zjd6y-xfkw7g?file=i18n.config.ts,nuxt.config.ts

If lazy is set to false it seems to work.

@AasmundN
Copy link
Author

nuxt-modules/i18n#2300

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants