-
Notifications
You must be signed in to change notification settings - Fork 13
Fix i18n component using wrong translations when inside slot #981
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
Conversation
474cec1 to
b34b7a3
Compare
Export Sizefluent-vue
|
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #981 +/- ##
==========================================
- Coverage 99.54% 98.60% -0.95%
==========================================
Files 12 12
Lines 220 215 -5
Branches 45 46 +1
==========================================
- Hits 219 212 -7
- Misses 0 1 +1
- Partials 1 2 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| const fluent = getContext( | ||
| rootContext, | ||
| // @ts-expect-error This is internal Vue feature added in https://github.com/vuejs/core/commit/11214eedd2699e15106c44927f4d1206b111fbd3 | ||
| instance?.vnode?.ctx /* Vue 3 */ ?? instance?.proxy?.$vnode?.context /* Vue 2 */, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from vuejs/core@11214ee:
- @internal lexical scope owner instance
this sounds exactly right! good find 👍🏼
wbolster
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i gave it a spin and it seems to work perfectly! 🤩
Description
Previously,
i18ncomponent was walking parent component tree to search for component with translations. This behavior is incorrect, but it is hard to get lexical rendering content in Vue.This PR switches to internal Vue API for getting lexical rendering context.
Linked Issues
Fixes #980
Additional context
vuejs/core@11214ee - API used by Vue to solve similar issue with CSS v-bind.
Technically this is a breaking change as this changes
i18ncomponent behavior and changes minimum required Vue 3 version. But I expect that nobody is using current behavior or a 3-year-old Vue 3 version.