feat(packages): add html i18n layer and shared dom locale helpers#1554
Closed
sampotts wants to merge 10 commits into
Closed
feat(packages): add html i18n layer and shared dom locale helpers#1554sampotts wants to merge 10 commits into
sampotts wants to merge 10 commits into
Conversation
36676d0 to
2fe8cc8
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
2fe8cc8 to
539fecd
Compare
539fecd to
cbde62a
Compare
cbde62a to
8418fb7
Compare
8418fb7 to
ea4835a
Compare
d45a4c8 to
3e63671
Compare
b592706 to
35332be
Compare
35332be to
355e590
Compare
3e63671 to
c64ed48
Compare
355e590 to
9c3828b
Compare
c64ed48 to
8e8a8da
Compare
f04bb64 to
6c7add5
Compare
6c7add5 to
b940a32
Compare
b940a32 to
1bb99dd
Compare
1bb99dd to
4fa50a2
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4fa50a2. Configure here.
4fa50a2 to
8570f9d
Compare
Centralize ambient lang, locale lookup chain merge, and effective locale in @videojs/utils/dom so React and the new Lit provider reuse the same behavior. Wire @videojs/html i18n subpath exports and wildcard locale packs on core/react. Co-authored-by: Cursor <cursoragent@cursor.com>
Track the locale that started a builtin merge so the first willUpdate can discard stale async results when lang changes before paint. Move media-i18n element safeDefine to define/i18n so @videojs/html barrel stays side-effect free. Co-authored-by: Cursor <cursoragent@cursor.com>
Clear stale builtin overlays when resolved locale changes before first paint, prefer regional caption tracks over generic language siblings, and document i18n define side effects for bundlers. Co-authored-by: Cursor <cursoragent@cursor.com>
Replace locales/en/index.ts with flat en.ts in html and react, fix react package export paths to *.d.ts, and add explicit react tsdown locale entries ahead of the locale-packs PR. Co-authored-by: Cursor <cursoragent@cursor.com>
When walking localeLookupChain, match an exact track language before any tag.startsWith fallback so generic fr is not chosen over fr-FR on fr-fr. Co-authored-by: Cursor <cursoragent@cursor.com>
The ./i18n API export shadows the catch-all wildcard, so consumers need an explicit ./define/i18n entry to side-effect register i18n custom elements. Co-authored-by: Cursor <cursoragent@cursor.com>
The define glob already marks define/i18n.js as side-effectful for bundlers. Co-authored-by: Cursor <cursoragent@cursor.com>
8570f9d to
e587e78
Compare
Caption track matching is deferred per the i18n design doc; the html i18n provider only handles UI string translation. Co-authored-by: Cursor <cursoragent@cursor.com>
Align with repo convention: create-i18n.test.ts beside create-i18n.ts. Co-authored-by: Cursor <cursoragent@cursor.com>
Register custom elements from @videojs/html/i18n per the design doc instead of a separate define subpath; remove stale src/i18n clean globs. Co-authored-by: Cursor <cursoragent@cursor.com>
Collaborator
Author
|
Consolidating i18n work into a single feature branch ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
@videojs/html(createI18n, provider/text mixins, elements, caption selection helper) with./i18nand./i18n/locales/*package exports.nearestLang,subscribeAmbientLang,mergeLocaleOverlays, andeffectiveLocaleinto@videojs/utils/domwith tests, and switches ReactcreateI18nto use those helpers.@videojs/coreand@videojs/reactlocale subpath exports to./i18n/locales/*so additional locale bundles do not need new export lines.Stack: targets
feat/i18n-react-layer(ReactcreateI18n/ ambient locale). Merge that PR before this one.Test plan
pnpm -F @videojs/utils test src/dom/testspnpm -F @videojs/html test src/i18n/tests/create-i18n-html.test.tspnpm -F @videojs/react test(or targeted i18n tests if present)pnpm typecheckMade with Cursor
Note
Medium Risk
Adds new i18n runtime plumbing (custom elements/context providers, async locale overlay loading, and new public exports), which can affect translation resolution and bundling/tree-shaking behavior across packages. Changes are localized but touch cross-package utilities and export maps, so misconfiguration could break imports or locale updates.
Overview
Adds a new
@videojs/htmli18n entrypoint (./i18n) that auto-registers<media-i18n-provider>and<media-text>, plus acreateI18n()factory that provides Lit context, controller, and mixins with support for ambientlanginheritance and async built-in locale overlays.Extends
@videojs/htmlbuild+package exports to ship./i18nand./i18n/locales/*(and marks the i18n index as a side-effectful module), and re-exports the i18n API from@videojs/htmlroot.Moves/centralizes DOM locale utilities into
@videojs/utils/dom(effectiveLocale,nearestLang,subscribeAmbientLang,mergeLocaleOverlays,localeFromDomLang) with tests, and updates React i18n to consume these helpers while widening React locale exports to./i18n/locales/*and adjusting its build entries accordingly.Reviewed by Cursor Bugbot for commit b5f1f0a. Bugbot is set up for automated code reviews on this repo. Configure here.