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

Scoping of i18n blocks in components #117

Closed
rubenduiveman opened this issue Jul 21, 2020 · 2 comments
Closed

Scoping of i18n blocks in components #117

rubenduiveman opened this issue Jul 21, 2020 · 2 comments
Labels
Status: Proposal Request for comments Type: Feature Includes new features

Comments

@rubenduiveman
Copy link

I have multiple components with one or more <i18n> blocks, and I noticed what I think is a scoping issue (or at least not clear from the documentation).

What I see:

  1. I load a component (ComponentA). All its translations in i18n blocks are added to the root i18n object. It has a "title" translation.
  2. I load a second component (ComponentB). All its translations in i18n blocks are added to the root i18n object. It also has a "title" translation. Existing translations are overwritten.
  3. ComponentA now displays the title from ComponentB.

What I expected:

  1. I load a component (ComponentA). All its translations in i18n blocks are added to a scoped section in the root i18n object. It has a "title" translation.
  2. I load a second component (ComponentB). All its translations in i18n blocks are added to a scoped section in the root i18n object. It also has a "title" translation, but it won't overwrite the "title" translation of ComponentA since both i18n blocks are scoped.
  3. ComponentA and ComponentB display their own titles.

Possible solutions (feature request):

  1. Scope i18n blocks in components by default (breaking change)
  2. Support <i18n scoped> (my preferred solution)

In any case, I feel the documentation could be more explicit on the current behavior.

@kazupon kazupon added Type: Feature Includes new features Status: Proposal Request for comments labels Jul 21, 2020
@ballonura
Copy link

Same problem and agree with your possible solutions

@kazupon
Copy link
Member

kazupon commented Dec 21, 2020

vue-i18n-loader@v2 or later, default scoepd.

@kazupon kazupon closed this as completed Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Proposal Request for comments Type: Feature Includes new features
Projects
None yet
Development

No branches or pull requests

3 participants