TypeError: "i18n is undefined" when extending Vue component
Version
Reproduction link
https://codesandbox.io/s/5zzm3m68rx?fontsize=14
Steps to reproduce
-
Create a component with translations using $t function.
-
Extend it anywhere else in the app
What is expected ?
Component should mount properly
What is actually happening?
A typeError is thrown because this.$i18n is undefined inside $t function
Additional comments?
i18n works as expected anywhere else in the app
I've never created components in such non-standard way, so I'm not sure how are things supposed to work in this case but, looking at the code of vue-i18n, I think it might be behavior specific to vue-i18n plugin itself, and not this module.
Are you able to reproduce it in pure Vue testcase? If so, I suggest reporting this problem in vue-i18n itself.
Ok I reproduced it with pure Vue and vue-i18n. Thanks @rchl for your response i'll report it on vue-i18n repo. If your intersted there's a link to the codesandbox I made to reproduce the bug.