Skip to content

feat(i18n): SahajCloud-owned labels for the Vidstack video controls - #239

Closed
sydevs-bot wants to merge 9 commits into
mainfrom
claude/feat-82-vidstack-labels
Closed

sydevs-bot wants to merge 9 commits into
mainfrom
claude/feat-82-vidstack-labels

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The video player's control bar, settings menu and caption-style panel read from wm-web-translations; 42 of Vidstack's 56 words are mapped, the other 14 keep its English.
  • Joined: a subtitle track is labelled with its language's endonym, not its uppercased tag. feat(i18n): source every UI string and the locale set from SahajCloud #80 recorded this as done and VideoPlayer.tsx still 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 this cannot 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

VIDEO_LAYOUT_KEYS   satisfies Partial<Record<DefaultLayoutWord, TranslationKey>>
UNREACHABLE_WORDS   satisfies readonly DefaultLayoutWord[]

type EveryLayoutWordHandled = AssertNever<Exclude<DefaultLayoutWord, HandledWord>>
  // a Vidstack word that is neither mapped nor listed unreachable fails tsc

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

 components/molecules/VideoPlayer/
 ├── VideoPlayer.tsx   # passes `translations`; names tracks by endonym
+├── labels.ts         # the phrase→key map, the unreachable list, the pure builder
 └── vtt.ts            # unchanged
 lib/
-└── locale-names.ts   # localeEndonym(locale: Locale)
+└── locale-names.ts   # localeEndonym(locale: string) — a track's language is not a site Locale

Preview

Both links open on real data. Press play, then hover the player: the control bar is drawn from the video tab.

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 whose video tab has copy.

Test results

  • Lean gate: ✓ lint + tsc --noEmit + test:run — 0 errors, 963 tests passed
  • Targeted specs: components/molecules/VideoPlayer/labels.test.ts (6), lib/locale-names.test.ts (5), tests/guards/translation-keys.test.ts
  • Build: ✓ pnpm build, and dist/server holds no Vidstack symbol (components/AGENTS.md)

Manual verification

  1. Open the player and the settings menu in a locale whose video tab a translator has filled. None exists yet — GET /api/globals/wm-web-translations?locale=fr&select[video]=true returns {} on production, so every locale still renders English until that copy is written.
  2. In Ladle, open the captions menu under Per-locale subtitles: it should list English and Español, not EN and ES.

Notes for reviewer

  • The ticket says media tab, 40 labels. SahajCloud shipped a video tab 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.
  • Seven words point outside the video tab, as feat(i18n): CMS-owned labels for the Vidstack video controls #82 resolved: Play, Pause, Mute, Unmute and Volume at media.a11y.*, the two fullscreen tooltips at blocks.a11y.*. SahajCloud seeded six of those under video.general.* as well, and those six are now orphans upstream — see the open thread on labels.ts:55. The blocks.a11y.* pair is sentence case, so those two tooltips read Enter fullscreen, not Vidstack's title case.
  • The 14 unmapped words were measured, not assumed, against @vidstack/[email protected] (the ticket measured 1.15.6; the word union is identical). The AirPlay and Google Cast buttons do render — as display: none and aria-hidden — so their English is in the DOM where nobody reads it.
  • The announcer needed no work. DefaultVideoLayout mounts DefaultAnnouncer, which hands the same translations to MediaAnnouncer. 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.
  • /simplify and /code-review could 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, ZZSPEED in 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.ts matches securityReview.triggerPattern): the only server change is one additive group in WEB_TRANSLATIONS_SELECT. The default layout contains no dangerouslySetInnerHTML and no innerHTML, 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 translations prop identity. The package does not support it — the layout rebuilds its context value on every render and nothing there is wrapped in React.memo. The useMemo stays as ordinary hygiene; getT already memoises t.

Words left unmapped, with the reason: AirPlay, Google Cast, Connected, Connecting, Disconnected (remote playback, not configured); Download (no download prop); LIVE, Skip To Live (VOD only); Chapters (no chapters track); Loop, Playback (the default layout never renders them); Disabled (Plyr's layout); Replay, Continue (DefaultAudioTitle only).

Closes #82

🤖 Generated with Claude Code

https://claude.ai/code/session_01Mg9rjYcqp715wKbcGHWFxC

`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
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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

@sydevs-bot

sydevs-bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 19:51Z resolve-conflicts · attempt 1 · session · done
  • 19:51Z resolve-conflicts · attempt 1 · session
  • 19:21Z address-review · attempt 1 · session · done
  • 19:21Z address-review · attempt 1 · session
  • 19:15Z review-pr · attempt 1 · session · done

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 15, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 15, 2026

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🧐 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 new t is shadowed at L110.
  • consider — labels.ts:124: Object.fromEntries widens to any, 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',

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Nov 15, 2026
sydevs-bot and others added 4 commits November 15, 2026 19:22
#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
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Addressed the adversarial review. Lean gate green: lint, tsc --noEmit, 963 tests.

  • Adopted labels.ts:55 — all seven shared control words now read the bank, as feat(i18n): CMS-owned labels for the Vidstack video controls #82 resolved (0d7bf21). A spec pins the decision. Left open: dropping the six orphaned video.general.* keys is a SahajCloud migration, so it is the reviewer's call, with options in the thread.
  • Adopted VideoPlayer.tsx:90 — the track callback no longer shadows t (272904d).
  • Part rebutted labels.ts:124 — as const fixes nothing there; fromEntries was already typed. The return type went unchecked because an index signature satisfies an all-optional target. Building the object word by word is checked (ec5048e).

origin/main merged in cleanly. Body refreshed: the Volume note and the test counts were false.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 15, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review November 15, 2026 19:33
@sydevs-bot
sydevs-bot requested a review from Ardnived November 15, 2026 19:33
@sydevs-bot
sydevs-bot enabled auto-merge November 15, 2026 19:33
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 15, 2026
sydevs-bot pushed a commit that referenced this pull request Nov 18, 2026
`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
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 18, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Working in SYDevelopers Technical Roadmap Nov 18, 2026
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
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Merged origin/main in. One conflict, in VideoPlayer.tsx's import block: main added posterURL, this branch added videoLayoutTranslations, useT and localeEndonym. Both sides kept — nothing else overlapped, and the poster and label changes touch different props.

Lean gate on the merge: lint 0 errors, tsc --noEmit clean, 1101 tests passed.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 18, 2026
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 18, 2026
@Ardnived

Copy link
Copy Markdown
Contributor

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 video.general.* keys, no longer apply — the whole video wording tab is dropped upstream as part of that goal.

The endonym fix for subtitle track labels in this PR is still wanted; it carries over to the new player.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

feat(i18n): CMS-owned labels for the Vidstack video controls

3 participants