docs(site): add i18n concept, guides, and API reference#1600
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
6f3b60d to
87ed51b
Compare
87ed51b to
2f16716
Compare
2f16716 to
d8d3bd8
Compare
d8d3bd8 to
249f8e4
Compare
249f8e4 to
99aff95
Compare
99aff95 to
07c5ff8
Compare
07c5ff8 to
14093e8
Compare
decepulis
left a comment
There was a problem hiding this comment.
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:
- 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)orhtml title="html"wouldn't be necessary with more consistent application. (I should add that thetitle="html"andtitle="react"block also missed the opportunity to use tabs) - 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.
- Similarly, the concept guide feels a bit too conceptually weedy. Maybe it goes too deep. Definitely it leans too jargony for my taste
- 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
- Lots of em dashes! The
docsskill has awriting-style.mdguide 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.
| { 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' }, |
There was a problem hiding this comment.
suggestion: What do you think of an internationalization folder?
| { | ||
| 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' }, | ||
| ], | ||
| }, |
There was a problem hiding this comment.
Oh that's new! I have mixed feelings about
- this being a subfolder of Features (blocking)
- 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)
There was a problem hiding this comment.
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.
14093e8 to
69ce7cd
Compare
| ## Register your own pack | ||
|
|
||
| ```ts title="my-es.ts" | ||
| import type { Translations } from '@videojs/core/i18n'; |
There was a problem hiding this comment.
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)
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.
There was a problem hiding this comment.
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).
❌ 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 }); | ||
| ``` |
There was a problem hiding this comment.
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)
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.
93791d0 to
879d941
Compare
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>


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
registerI18npre-cache patterns), SSR, and contributor built-in locale workflowI18nProvider, hooks, HTML elements,createI18n, and core types (Locale,Translations,Translator, etc.)I18nProviderlisted under Components (alongsidePlayer.Provider); hooks and factories stay under Hooks & UtilitiesStack 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
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, HTMLmedia-i18n-provider/media-text, and core types.Sidebar entries in
docs.config.tswire those pages under Concepts, How to, Components, Hooks & Utilities, Controllers & Mixins, and Features (including a Types subsection).Supporting code (not new i18n behavior):
@publicJSDoc on core registry/translator exports; React defaultI18nProvider/ hooks exported fromcreate-i18n.tsxwith a slimmeri18n/index.tsre-export; api-docs-builder scans@videojs/react/i18nand@videojs/core/i18n, fixes kebab slugs forI18n*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.