You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think I understand my error, but it's not explained at all in the Nuxt-i18n documentation why there is sometime a useScope: 'local' in the useI18n() call.
I changed my code for this:
const{ locale, locales }=useI18n({useScope: 'global'});const{ t }=useI18n({useScope: 'local'});
Now I don't have the error:
Cannot read properties of undefined (reading 'filter')
Feel free to close if there is no change needed to the documentation.
Thank you for reporting, I think I know what the source of this behavior, I ran into it (or something similar) during recent refactors but preserved the original behavior as I wasn't sure if it was intended either.
I'm going to check if I can keep the behavior the same regardless of the presence of <i18n> block or local scope usage 🙏.
Environment
Reproduction
https://stackblitz.com/edit/github-9ytrzgtu?file=pages%2Findex.vue
Describe the bug
As soon as I add an i18n custom block to my component, the app crash with this error:
The code for the language switcher comes from the documentation (except the console.log):
I notice that locales is sometime a
ComputedRef
and sometime aReactive
.Where there is a
<i18n>
custom block:When there isn't one:
That would explain why the
locales.value.filter
since aReactive
doesn't need a.value
Additional context
No response
Logs
The text was updated successfully, but these errors were encountered: