vue-i18n icon indicating copy to clipboard operation
vue-i18n copied to clipboard

Is there any way to make injected properties local scope in Composition mode

Open LasyIsLazy opened this issue 3 years ago • 2 comments
trafficstars

Clear and concise description of the problem

For some reason, I have to use both Vue composition API and Vue legacy API in my project.

I prefer composition API, so I set legacy: false and globalInjection: true, i18n will be in Composition mode and I can use $i18n in code.

But $i18n.locale always refers to global scope locale, and I can't use local scope in Vue legacy code.

Suggested solution

Add some config to change injected properties's scope, when the Vue component have locale scope, injected properties can refers to local scope

Alternative

No response

Additional context

No response

Validations

LasyIsLazy avatar Apr 28 '22 10:04 LasyIsLazy

Or maybe export some API that can access local i18n composer from Legacy Vue code

LasyIsLazy avatar Apr 28 '22 11:04 LasyIsLazy

Additionally, $i18n refers to local scope when there is i18n option in Legacy mode.

LasyIsLazy avatar Apr 29 '22 09:04 LasyIsLazy