Skip to content

feat(packages): add built-in locale packs with v8 parity#1566

Closed
sampotts wants to merge 12 commits into
feat/i18n-ui-elementsfrom
feat/i18n-locale-packs
Closed

feat(packages): add built-in locale packs with v8 parity#1566
sampotts wants to merge 12 commits into
feat/i18n-ui-elementsfrom
feat/i18n-locale-packs

Conversation

@sampotts
Copy link
Copy Markdown
Collaborator

@sampotts sampotts commented May 19, 2026

Summary

  • Add 50+ built-in locale packs in @videojs/core (default export per @videojs/core/i18n/locales/*), with pt/zh v8 aliases and pt-BR/pt-PT, zh-CN/zh-TW splits.
  • Expose framework entry points at @videojs/html/i18n and @videojs/react/i18n (locales/*, all) so apps register packs without importing core directly.
  • Wire sandbox locale picker and completeness tests; ignore accidental src declaration emit under i18n paths.

Closes #1368

Stacked on #1367 (feat/i18n-ui-elements).

Test plan

  • pnpm -F @videojs/core test src/core/i18n/tests
  • pnpm -F @videojs/core build && pnpm -F @videojs/html build && pnpm typecheck
  • Sandbox: switch locale on HTML and React video demos; confirm control labels update
  • import es from '@videojs/html/i18n/locales/es' + registerI18n('es', es) works

Made with Cursor


Note

Medium Risk
Medium risk due to introducing many new i18n exports/entrypoints and build config changes across core, html, and react, which could affect package resolution and bundle size. Sandbox wiring is low risk but depends on new postMessage/query-param plumbing for locale.

Overview
Adds built-in i18n locale packs (50+ translations) to @videojs/core, including new @videojs/*/i18n/all entrypoints, v8 alias tags (pt, zh), and pt-BR/pt-PT, zh-CN/zh-TW splits.

Updates package exports and build configs (tsdown.config.ts) for core, html, and react to ship i18n/all and per-locale modules, and refactors BuiltInLocale typing to derive from a single BUILT_IN_LOCALES list.

Wires the sandbox to support runtime language switching via a new locale query param and postMessage channel, adds a language picker in the settings menu for video presets, and updates HTML/React templates to apply the selected locale to their i18n providers.

Reviewed by Cursor Bugbot for commit 06c0f4f. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
v10-sandbox Error Error May 23, 2026 1:32am

Request Review

@sampotts sampotts force-pushed the feat/i18n-ui-elements branch 3 times, most recently from 07f598b to 56466e2 Compare May 20, 2026 03:31
@sampotts sampotts force-pushed the feat/i18n-locale-packs branch from 9f2dc4e to 63898ce Compare May 20, 2026 03:31
@sampotts sampotts force-pushed the feat/i18n-ui-elements branch from 56466e2 to aa63876 Compare May 20, 2026 05:25
@sampotts sampotts force-pushed the feat/i18n-locale-packs branch from 395fc2f to 3f036bb Compare May 20, 2026 05:25
@sampotts sampotts force-pushed the feat/i18n-ui-elements branch from aa63876 to eeb7263 Compare May 20, 2026 05:28
@sampotts sampotts force-pushed the feat/i18n-locale-packs branch from 3f036bb to ff04df3 Compare May 20, 2026 05:29
@sampotts sampotts force-pushed the feat/i18n-locale-packs branch from ff04df3 to 6401cdb Compare May 20, 2026 05:33
@sampotts sampotts force-pushed the feat/i18n-ui-elements branch from 2946154 to a9ebb9f Compare May 20, 2026 05:49
@sampotts sampotts force-pushed the feat/i18n-locale-packs branch from 6401cdb to 311a1a6 Compare May 20, 2026 05:49
@sampotts sampotts force-pushed the feat/i18n-ui-elements branch from a9ebb9f to 1e9229b Compare May 20, 2026 06:02
@sampotts sampotts force-pushed the feat/i18n-locale-packs branch from 311a1a6 to 470a768 Compare May 20, 2026 06:08
@sampotts sampotts marked this pull request as ready for review May 20, 2026 06:16
@sampotts sampotts requested review from luwes and mihar-22 May 20, 2026 06:23
Comment on lines +20 to +21
startCasting: 'Übertragung starten',
stopCasting: 'Übertragung beenden',
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
startCasting: 'Übertragung starten',
stopCasting: 'Übertragung beenden',
startCasting: 'Streamen',
stopCasting: 'Streamen beenden',

Chrome's UI used to use übertragen for casting, but settled on streamen a while back.

startCasting: 'Übertragung starten',
stopCasting: 'Übertragung beenden',
connectingCast: 'Verbinden',
seek: 'Status',
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

v8 has "Status" for "Progress", but this probably isn't right if the English is "seek". How and where is this used?

Comment on lines +17 to +18
playingLive: 'Zur Live-Übertragung wechseln. Es wird aktuell live abgespielt.',
seekToLiveEdge: 'Zur Live-Übertragung wechseln. Aktuell wird es nicht live abgespielt.',
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
playingLive: 'Zur Live-Übertragung wechseln. Es wird aktuell live abgespielt.',
seekToLiveEdge: 'Zur Live-Übertragung wechseln. Aktuell wird es nicht live abgespielt.',
playingLive: 'Es wird live abgespielt.',
seekToLiveEdge: 'Zurück zur Liveübertragung.',

These always were more clunky than they needed to be in v8.

play: 'Wiedergabe',
pause: 'Pause',
replay: 'Erneut abspielen',
mute: 'Stumm schalten',
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
mute: 'Stumm schalten',
mute: 'Stummschalten',

Comment thread apps/sandbox/templates/react-video/main.tsx
sampotts and others added 12 commits May 22, 2026 12:12
Ship 50+ non-English locale modules in core (default export per pack),
with framework entry points at @videojs/html/i18n and @videojs/react/i18n
(locales/* and all). Includes pt-BR/pt-PT and zh-CN/zh-TW splits, pt/zh
v8 aliases, locale completeness tests, dynamic tsdown entries, and
sandbox locale picker wiring.

Closes #1368

Co-authored-by: Cursor <cursoragent@cursor.com>
Fill in remaining built-in translations, restore per-locale
timeSliderValueTextRange for screen readers, and drop redundant
slider keys that do not vary by language.

Co-authored-by: Cursor <cursoragent@cursor.com>
Satisfies ParametricTranslations so html/react i18n/all typechecks.

Co-authored-by: Cursor <cursoragent@cursor.com>
src/ is gitignored; Vercel clones without it so dir-compare failed.

Co-authored-by: Cursor <cursoragent@cursor.com>
Mirror-only setup is enough for CI and fresh clones; use reset/sync
when src drifts from templates.

Co-authored-by: Cursor <cursoragent@cursor.com>
Replace English PiP labels left in the ko locale pack.

Co-authored-by: Cursor <cursoragent@cursor.com>
Locale pack aggregation lives in html and react; core does not ship this entry.

Co-authored-by: Cursor <cursoragent@cursor.com>
Intl.DisplayNames maps the v8 `ba` tag to Bashkir; override it to Bosnian.

Co-authored-by: Cursor <cursoragent@cursor.com>
Video.js v8 used ba for Bosnian, but BCP 47 assigns ba to Bashkir and bs to
Bosnian. Use the correct tag so Intl labels and locale lookup work without
sandbox overrides.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep generic language tags in the locale union alongside regional packs.

Co-authored-by: Cursor <cursoragent@cursor.com>
Move the aggregated locale map to @videojs/core/i18n/all and keep thin
html/react entry points for existing import paths.

Co-authored-by: Cursor <cursoragent@cursor.com>
Avoid a flash of English copy when the sandbox locale changes after mount.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 06c0f4f. Configure here.

indicatorFullscreen: 'Plein écran',
indicatorExitFullscreen: 'Quitter le plein écran',
indicatorPictureInPicture: 'Image dans l’image',
indicatorExitPictureInPicture: 'Quitter l’image dans l’image',
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

French locale mixes apostrophe character encodings

Low Severity

The French locale uses two different apostrophe characters for the same text. Lines 15–16 use double-quoted strings (containing ASCII APOSTROPHE U+0027 for l'image), while lines 40–41 use single-quoted strings with Unicode RIGHT SINGLE QUOTATION MARK U+2019 for the identical phrase. Same inconsistency affects s'est on lines 50 and 52. French users see visually mismatched apostrophes across different UI contexts.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 06c0f4f. Configure here.

@sampotts
Copy link
Copy Markdown
Collaborator Author

Consolidating i18n work into a single feature branch (feat/i18n) until the feature is complete. This stacked PR is closed; we will reopen as a fresh split review stack from feat/i18n when ready for review.

@sampotts sampotts closed this May 22, 2026
@sampotts sampotts deleted the feat/i18n-locale-packs branch May 22, 2026 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants