Skip to content

Conversation

@Demivan
Copy link
Member

@Demivan Demivan commented Nov 16, 2025

Description

Previously, i18n component 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 i18n component 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.

@Demivan Demivan added Type: Bug Something isn't working Type: Breaking Breaking change for library users labels Nov 16, 2025
@Demivan Demivan force-pushed the fix/980-i18n-slot-context branch from 474cec1 to b34b7a3 Compare November 16, 2025 09:37
@github-actions
Copy link

github-actions bot commented Nov 16, 2025

Export Size

fluent-vue

Name Size Diff
useFluent 966 B +5 B (+0.52%) 🔺
createFluentVue 4.12 KB -9 B (-0.21%) 🔽

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 16, 2025

Open in StackBlitz

npm i https://pkg.pr.new/fluent-vue/fluent-vue@981

commit: b34b7a3

@codecov
Copy link

codecov bot commented Nov 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.60%. Comparing base (b6d08a9) to head (b34b7a3).
⚠️ Report is 1 commits behind head on main.

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     
Flag Coverage Δ
vue-2 86.04% <66.66%> (-1.69%) ⬇️
vue-3 90.69% <66.66%> (-1.58%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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 */,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from vuejs/core@11214ee:

this sounds exactly right! good find 👍🏼

Copy link
Contributor

@wbolster wbolster left a 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! 🤩

wbolster

This comment was marked as duplicate.

@Demivan Demivan merged commit 003d046 into main Nov 16, 2025
15 checks passed
@Demivan Demivan deleted the fix/980-i18n-slot-context branch November 16, 2025 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Breaking Breaking change for library users Type: Bug Something isn't working

Development

Successfully merging this pull request may close these issues.

i18n component using wrong translations when inside slot

3 participants