Skip to content

docs(site): add i18n concept, guides, and API reference#1600

Draft
sampotts wants to merge 8 commits into
feat/i18n-sandboxfrom
docs/i18n
Draft

docs(site): add i18n concept, guides, and API reference#1600
sampotts wants to merge 8 commits into
feat/i18n-sandboxfrom
docs/i18n

Conversation

@sampotts

@sampotts sampotts commented May 26, 2026

Copy link
Copy Markdown
Collaborator

Closes #1373

Summary

Adds site documentation for the Video.js 10 i18n system: concept page, how-to guides, API/util reference pages, and sidebar wiring. Stacks on the i18n implementation branch (feat/i18n-sandbox).

Changes

  • Concept page covering opaque keys, registry, providers, BCP 47 fallback, and merge priority
  • How-to guides: register locale, override keys, switch locale (including registerI18n pre-cache patterns), SSR, and contributor built-in locale workflow
  • Reference pages for registry APIs, I18nProvider, hooks, HTML elements, createI18n, and core types (Locale, Translations, Translator, etc.)
  • I18nProvider listed under Components (alongside Player.Provider); hooks and factories stay under Hooks & Utilities
  • api-docs-builder entry points and JSDoc on core/react i18n exports for generated util reference tables
Stack info

Docs PR — targets feat/i18n-sandbox (#1593). Merge after the i18n implementation stack lands, or merge into the stack before the sandbox PR if preferred.

Testing

pnpm -F site api-docs
pnpm -F site build

Verify pages under Concepts → Internationalization, How to → i18n guides, and Features / Components / Hooks reference sections.

Made with Cursor


Note

Low Risk
Documentation and doc-generation/export surface only; no changes to i18n resolution, registry merge, or provider runtime logic.

Overview
This PR adds site documentation for Video.js 10 internationalization: a Concepts → Internationalization page, five how-to guides (register locale, overrides, runtime switch, SSR, contributor built-in locales), and reference pages for registry APIs, React I18nProvider/hooks, HTML media-i18n-provider / media-text, and core types.

Sidebar entries in docs.config.ts wire those pages under Concepts, How to, Components, Hooks & Utilities, Controllers & Mixins, and Features (including a Types subsection).

Supporting code (not new i18n behavior): @public JSDoc on core registry/translator exports; React default I18nProvider / hooks exported from create-i18n.tsx with a slimmer i18n/index.ts re-export; api-docs-builder scans @videojs/react/i18n and @videojs/core/i18n, fixes kebab slugs for I18n* names, and normalizes multi-part JSDoc descriptions for generated util reference JSON.

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

@vercel

vercel Bot commented May 26, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
v10-sandbox Ready Ready Preview, Comment Jun 19, 2026 2:27am

Request Review

@sampotts sampotts force-pushed the feat/i18n-sandbox branch from 6f3b60d to 87ed51b Compare June 18, 2026 05:42
@sampotts sampotts force-pushed the feat/i18n-sandbox branch from 87ed51b to 2f16716 Compare June 18, 2026 05:50
@sampotts sampotts force-pushed the feat/i18n-sandbox branch from 2f16716 to d8d3bd8 Compare June 18, 2026 05:53
@sampotts sampotts force-pushed the feat/i18n-sandbox branch from d8d3bd8 to 249f8e4 Compare June 18, 2026 05:57
@sampotts sampotts force-pushed the feat/i18n-sandbox branch from 249f8e4 to 99aff95 Compare June 18, 2026 06:03
@sampotts sampotts force-pushed the feat/i18n-sandbox branch from 99aff95 to 07c5ff8 Compare June 18, 2026 07:05
Comment thread site/scripts/api-docs-builder/src/util-handler.ts Outdated
Comment thread site/scripts/api-docs-builder/src/util-handler.ts
@sampotts sampotts force-pushed the feat/i18n-sandbox branch from 07c5ff8 to 14093e8 Compare June 18, 2026 10:09

@decepulis decepulis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not a full review yet. Just a quick pass to start!
Love the references. Left a couple of smaller comments. And I've got a couple broad notes:

  1. I'm noticing some places these guides don't follow our conventions to separate html and react. I see loads of FrameworkCase... but... still not consistently applied. Something like ### Prefetch before switching (React) or html title="html" wouldn't be necessary with more consistent application. (I should add that the title="html" and title="react" block also missed the opportunity to use tabs)
  2. I'm noticing how-to guides re-explaining concepts. In an ideal world, concepts give you the mental model of how things are laid out, and how-to can just link back to them. in the mux world, this would be like a concept guide about "assets" and a how-to guide about upload a video to mux. It's a hard boundary to cleanly enforce, I acknowledge that.
  3. Similarly, the concept guide feels a bit too conceptually weedy. Maybe it goes too deep. Definitely it leans too jargony for my taste
  4. I'm noticing a lot of overlap between i18n-switch-locale and i18n-ssr. Maybe that's the right solution... but... it makes me itch for consolidation
  5. Lots of em dashes! The docs skill has a writing-style.md guide that I don't see enforced here. Maybe that means you didn't use the skill. Maybe that means the skill isn't very good.

Not comprehensive. Just prompting another pass! Maybe with a bit more of the docs skill and writing-guides.mdx and https://diataxis.fr/ in mind / in context. Or, if this feels heavy/blocking, maybe park this PR until we do a more comprehensive docs pass.

Comment thread site/src/docs.config.ts Outdated
Comment on lines +53 to +57
{ slug: 'how-to/i18n-register-locale', sidebarLabel: 'Register a locale' },
{ slug: 'how-to/i18n-override-translations', sidebarLabel: 'Override translations' },
{ slug: 'how-to/i18n-switch-locale', sidebarLabel: 'Switch locale' },
{ slug: 'how-to/i18n-ssr', sidebarLabel: 'SSR with locale' },
{ slug: 'how-to/i18n-add-built-in-locale', sidebarLabel: 'Add a built-in locale' },

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

suggestion: What do you think of an internationalization folder?

Comment thread site/src/docs.config.ts Outdated
Comment on lines +148 to +158
{
sidebarLabel: 'Types',
defaultOpen: false,
contents: [
{ slug: 'reference/built-in-locale', sidebarLabel: 'BuiltInLocale' },
{ slug: 'reference/locale', sidebarLabel: 'Locale' },
{ slug: 'reference/translation-params', sidebarLabel: 'TranslationParams' },
{ slug: 'reference/translations', sidebarLabel: 'Translations' },
{ slug: 'reference/translator', sidebarLabel: 'Translator' },
],
},

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Oh that's new! I have mixed feelings about

  1. this being a subfolder of Features (blocking)
  2. this being a limited subset of types rather than a pass at all the types we might choose to expose (discussion. my s1 is to not include these, but I could be convinced)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is our first guide for contributors! I think it's an opportunity to talk about how we want to serve them in the docs.

In the past, we've decided to hold off on that for now. To keep contributor docs as markdown in source code (e.g., packages/core/src/core/i18n/README.md), not in the docs yet. I'm not dogmatic about that, but, I would prefer a separate section in the sidebar at least.

## Register your own pack

```ts title="my-es.ts"
import type { Translations } from '@videojs/core/i18n';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Core i18n imports in docs

Low Severity

Several new i18n guides and reference pages tell app authors to import types and APIs from @videojs/core/i18n. Those symbols are re-exported from @videojs/react/i18n and @videojs/html/i18n, which user-facing docs should prefer instead of exposing core.

Additional Locations (2)
Fix in Cursor Fix in Web

Triggered by learned rule: Do not expose @videojs/core imports in user-facing docs or examples

Reviewed by Cursor Bugbot for commit 5382edc. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 using default effort and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

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 62cf627. Configure here.

const t = createTranslator(getI18nTranslations('fr'), 'fr');
t('play');
t('seekForward', { seconds: 5 });
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Docs import from core package

Medium Severity

New i18n guides and reference pages show imports from @videojs/core/i18n for createTranslator, getI18nTranslations, and types like Translations, even though @videojs/html/i18n and @videojs/react/i18n re-export the same APIs for user-facing bundles.

Additional Locations (2)
Fix in Cursor Fix in Web

Triggered by learned rule: Do not expose @videojs/core imports in user-facing docs or examples

Reviewed by Cursor Bugbot for commit 62cf627. Configure here.

@sampotts sampotts force-pushed the feat/i18n-sandbox branch from 93791d0 to 879d941 Compare June 19, 2026 03:57
sampotts and others added 8 commits June 19, 2026 14:09
Documents opaque keys, registry APIs, React/HTML providers, and locale
workflows for #1373. Extends api-docs-builder discovery for core/react
i18n exports and adds matching reference MDX pages.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add Locale, BuiltInLocale, TranslationParams, Translations, and Translator
reference pages plus createTranslator. Cross-link types from concept and
guides; fix React examples and register-locale satisfies pattern.

Co-authored-by: Cursor <cursoragent@cursor.com>
Document registerI18n pre-caching at bootstrap and before switch,
compare with I18nProvider translations prop, and note global merge behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
Remove frameworkTitle overrides so the i18n concept page matches other
concept pages with one title across HTML and React modes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Group I18nProvider with Player.Provider and Player.Container as
infrastructure providers; keep createI18n and hooks under Hooks & Utilities.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@sampotts sampotts marked this pull request as draft June 19, 2026 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants