i18n icon indicating copy to clipboard operation
i18n copied to clipboard

TypeError: "i18n is undefined" when extending Vue component

Open ValentinCrochemore opened this issue 7 years ago • 2 comments

Version

v5.3.0

Reproduction link

https://codesandbox.io/s/5zzm3m68rx?fontsize=14

Steps to reproduce

  1. Create a component with translations using $t function.

  2. 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

This bug report is available on Nuxt community (#c231)

ValentinCrochemore avatar Apr 29 '19 12:04 ValentinCrochemore

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.

rchl avatar Apr 30 '19 15:04 rchl

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.

ValentinCrochemore avatar Apr 30 '19 16:04 ValentinCrochemore