Repository navigation
feat(i18n): SahajCloud-owned labels for the Vidstack video controls - #239
sydevs-bot wants to merge 9 commits into
Conversation
`wm-web-translations` gained a `video` tab (sydevs/SahajCloud#775), seeded and published on production. Selecting it is what lets the Vidstack control labels resolve through `useT()`. Refs #82 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYcqp715wKbcGHWFxC
`<DefaultVideoLayout>` shipped its English labels untouched, so the player's control bar, settings menu and caption styles stayed English on every locale. Its `translations` prop overrides them, keyed by the English phrase itself — `Captions look like this` cannot be a SahajCloud field name — so a phrase-to-key map is what the prop needs. `labels.ts` holds that map, typed against `DefaultLayoutWord`, beside the words this player's configuration cannot reach. A Vidstack upgrade that adds a word is a compile error rather than a label that quietly stays English. Closes #82 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYcqp715wKbcGHWFxC
Measured in a browser: `<DefaultVideoLayout>` renders the AirPlay and Google Cast buttons with `display: none` and `aria-hidden`, so their English is in the DOM even though nobody reads it. A reader grepping the page for an unmapped word would otherwise read the list as wrong. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYcqp715wKbcGHWFxC
The lint catches a literal this repo writes. A library that ships its own English labels passes it untouched, so the convention needs to say where those go. Drops a claim about Vidstack re-rendering on prop identity that the package does not support: its layout rebuilds the context value on every render regardless, and nothing there is memoised. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYcqp715wKbcGHWFxC
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-design | 1d999cc | Commit Preview URL Branch Preview URL |
Nov 18 2026, 07:55 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-web | 1d999cc | Commit Preview URL Branch Preview URL |
Nov 18 2026, 07:55 PM |
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The shape matches #82 and the diff is no bigger than it: a phrase→key map, the prop, a spec, and the endonym fix #80 recorded as done but left undone. #82 settled that nothing upstream can be imported, so the map is forced rather than invented.
One of #82's resolved decisions is reversed with no line saying so. Six of the seven keys it told you to reuse are now duplicated inside the new video tab, and Volume alone reuses the bank. Settle that before merge.
Findings
- should-fix —
labels.ts:55: four exact and two near-duplicate strings, against #82's "do not seed a second copy". - should-fix —
VideoPlayer.tsx:90: the newtis shadowed at L110. - consider —
labels.ts:124:Object.fromEntrieswidens toany, so the return type goes unchecked.
What was checked
Read whole on the branch: labels.ts, labels.test.ts, VideoPlayer.tsx, lib/locale-names.ts, lib/i18n.ts, hooks/useT.ts, the key guard.
Ladder. labels.ts has two consumers, the player and the key guard, so it is not a single-caller file. UNREACHABLE_WORDS + AssertNever are the drift guard #82 asked for, and satisfies Partial<> alone would not catch an added word. localeEndonym widening to string is forced: a track's language is not a site Locale. All three hold.
Contract. video is already in WmWebTranslationsSelect on main, so the WEB_TRANSLATIONS_SELECT line needs no types:cms run.
Preview. /lectures/163 returns 200 and its serialised pageContext carries the whole video tab — captions_look_like_this is in the HTML — so the select reaches the browser. The Ladle link returns a 200 JS shell; its story was not read.
Not raised: the video tab adds ~900 bytes to every page's payload, video or not. That is WEB_TRANSLATIONS_SELECT's all-or-nothing shape, not this PR's.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
| Opacity: 'video.general.opacity', | ||
| Pause: 'video.general.pause', | ||
| PiP: 'video.a11y.pip', | ||
| Play: 'video.general.play', |
There was a problem hiding this comment.
Play, Pause, Mute, Unmute duplicate media.a11y.* exactly; Enter/Exit Fullscreen duplicate blocks.a11y.* but for casing. #82 resolved the opposite — do not seed a second copy of a string the bank renders — naming these six and Volume. Only Volume follows it (L69), so "Play" is now translated twice and the two players can drift. Reuse all seven and drop the orphan video.general.* keys upstream, or add video.general.volume and reuse none?
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
There was a problem hiding this comment.
Adopted (0d7bf21): all seven point at the bank — media.a11y.{play,pause,mute,unmute,volume}, blocks.a11y.{enter,exit}_fullscreen. A spec pins it. The blocks pair is sentence case, so those tooltips read Enter fullscreen.
The six orphaned video.general.* keys are SahajCloud's call:
- A — leave them (recommended): merges now, unused until a later prune.
- B — drop them upstream: a migration, six fewer fields to translate, and this PR waits.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
#82 resolved that the map reuses the keys the bank already renders, so a translator fills "Play" once. Only `Volume` followed it: the other six were pointed at the `video` tab's own copies, which upstream seeded alongside them. The two `blocks.a11y.*` strings are sentence case, so the identity spec now compares case-insensitively, and a new case pins the decision so a later edit cannot re-duplicate silently. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVJiZPCgJSmxZMUBaH
`t` now names the translation accessor for the whole component, and the subtitle-track callback took the same name. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVJiZPCgJSmxZMUBaH
The declared `Partial<DefaultLayoutTranslations>` checked nothing: `Object.fromEntries` returns an index signature, and an index signature satisfies an all-optional target whatever its value type. Assigning each word into the accumulator is checked. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVJiZPCgJSmxZMUBaH
|
Addressed the adversarial review. Lean gate green: lint,
🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
`Smoke (ladle)` spent its whole reachability budget on a dead address and
exited 1:
selected https://8c49b588.wm-design.pages.dev [pr-comment(...), project=wemeditate-design]
reachability attempt 20: fetch failed
Preview environment never became reachable.
That host is the Cloudflare Pages comment from 2026-10-27, three weeks
before the playground moved to Workers. It matched the target by project
name and sorted first, so it won. Its DNS no longer resolves.
Two changes, because this pull request needs both. Discovery now accepts a
`workers.dev` host and nothing else, which is what both previews are, so
the Pages leftover is no longer a candidate. And a pull request older than
the design Worker's Git integration gets no Workers comment for it at all,
which leaves the live preview in no source discovery reads — so once the
whole discovery window has named nothing, it spells the Worker's own branch
host, taking the account subdomain from whatever other preview the pull
request does carry. The derived address is checked for reachability like any
other, and it runs only after the window so it cannot pre-empt a build still
deploying with the branch's previous one.
`claude-fix-135-carousel-dot-cells-wemeditate-design.contact-c66.workers.dev`
answers 200. The same derivation reproduces, character for character, the
Branch Preview URL Cloudflare posted on #239.
The defect is on `main` too: every pull request opened before 2026-11-02
reddens this check the same way. Fixing it here is what makes this one
mergeable.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjX4qwouF6Ve5nMtMED
VideoPlayer.tsx conflicted on its import block only: main added posterURL, this branch added videoLayoutTranslations, useT and localeEndonym. Both sides kept. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYxP41HWzD3cmgqAFh
|
Merged Lean gate on the merge: lint 0 errors, 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
Closing as superseded, decided in the terminal on 2026-11-18: the video player moves to Video.js 10 before the launch (#242), and it ships its own control labels in each language. So the phrase map here, and the open thread about the six unused The endonym fix for subtitle track labels in this PR is still wanted; it carries over to the new player. |
Pull request was closed
Summary
wm-web-translations; 42 of Vidstack's 56 words are mapped, the other 14 keep its English.VideoPlayer.tsxstill called.toUpperCase().Change outline
Flow — one control label, from SahajCloud to the button
The map is the whole deliverable: Vidstack looks a label up by its own English phrase, and
Captions look like thiscannot be a SahajCloud field name.loadSiteContext(pageContext) server/site-context.ts getWebTranslations({ locale }) # WEB_TRANSLATIONS_SELECT + select[video]=true # the tab sydevs/SahajCloud#775 added … <VideoPlayer> components/molecules/VideoPlayer/VideoPlayer.tsx useT() # pageContext.translations, else the snapshot + videoLayoutTranslations(t) components/molecules/VideoPlayer/labels.ts + 42 words → t('video.general.captions') … # 7 shared controls reuse media/blocks keys <DefaultVideoLayout translations={…}> @vidstack/react i18n(translations, word) ?? word # an omitted word keeps Vidstack's English + DefaultAnnouncer → <MediaAnnouncer translations> # same map, no second prop - <Track label={lang.toUpperCase()}> # "SV" + <Track label={localeEndonym(lang)}> # "Svenska"Types — what stops the map drifting
An unmapped word renders its English phrase, which looks exactly like a working player, so nothing but the type catches an upgrade that adds one.
Files
Preview
Both links open on real data. Press play, then hover the player: the control bar is drawn from the
videotab.useT()Every visible label on the first link resolves through the new map, checked in a browser:
Play,Seek,Mute,Volume,Captions,Settings,PiP,Fullscreen. They read as English because English is the only locale whosevideotab has copy.Test results
lint + tsc --noEmit + test:run— 0 errors, 963 tests passedcomponents/molecules/VideoPlayer/labels.test.ts(6),lib/locale-names.test.ts(5),tests/guards/translation-keys.test.tspnpm build, anddist/serverholds no Vidstack symbol (components/AGENTS.md)Manual verification
videotab a translator has filled. None exists yet —GET /api/globals/wm-web-translations?locale=fr&select[video]=truereturns{}on production, so every locale still renders English until that copy is written.EnglishandEspañol, notENandES.Notes for reviewer
mediatab, 40 labels. SahajCloud shipped avideotab with 41 keys (feat(translations): CMS-owned labels for the We Meditate video player SahajCloud#775). This builds against what is deployed and seeded, not against the ticket's proposal.videotab, as feat(i18n): CMS-owned labels for the Vidstack video controls #82 resolved:Play,Pause,Mute,UnmuteandVolumeatmedia.a11y.*, the two fullscreen tooltips atblocks.a11y.*. SahajCloud seeded six of those undervideo.general.*as well, and those six are now orphans upstream — see the open thread onlabels.ts:55. Theblocks.a11y.*pair is sentence case, so those two tooltips readEnter fullscreen, not Vidstack's title case.@vidstack/[email protected](the ticket measured 1.15.6; the word union is identical). The AirPlay and Google Cast buttons do render — asdisplay: noneandaria-hidden— so their English is in the DOM where nobody reads it.DefaultVideoLayoutmountsDefaultAnnouncer, which hands the sametranslationstoMediaAnnouncer. The ticket left this to a browser check; it is settled from the package source, and all 12 announcer words are already in the map./simplifyand/code-reviewcould not be delegated — four review subagents ran without ever reporting and were stopped. The four angles plus the security sweep were done in-session instead.comment-lint.mjs: no banned comment added.Detail
How the values were proved to come from SahajCloud, not Vidstack. English copy is identical on both sides, so a correct-looking control bar proves nothing. Distinctive values were written into
lib/translations.en.json, the player was driven in a browser, and the control bar read them back (ZZPLAY,ZZCAPTIONS,ZZSETTINGS,ZZVOLUME,ZZSEEK,ZZSPEEDin the settings menu). The snapshot was then restored; nothing of that experiment is in the branch.Why the map lives beside the component. It is specific to one third-party dependency's word list, and the type that guards it is that package's own union.
Security sweep (
server/sahajcloud-types.tsmatchessecurityReview.triggerPattern): the only server change is one additive group inWEB_TRANSLATIONS_SELECT. The default layout contains nodangerouslySetInnerHTMLand noinnerHTML, so every label is React text or an attribute — a CMS editor cannot inject markup through one.Dropped from an earlier commit in this branch: a comment claiming Vidstack re-renders on
translationsprop identity. The package does not support it — the layout rebuilds its context value on every render and nothing there is wrapped inReact.memo. TheuseMemostays as ordinary hygiene;getTalready memoisest.Words left unmapped, with the reason:
AirPlay,Google Cast,Connected,Connecting,Disconnected(remote playback, not configured);Download(nodownloadprop);LIVE,Skip To Live(VOD only);Chapters(no chapters track);Loop,Playback(the default layout never renders them);Disabled(Plyr's layout);Replay,Continue(DefaultAudioTitleonly).Closes #82
🤖 Generated with Claude Code
https://claude.ai/code/session_01Mg9rjYcqp715wKbcGHWFxC