Skip to content

fix(i18n): the meditation player's upsell copy stays English - #232

Merged
sydevs-bot merged 6 commits into
mainfrom
claude/fix-178-upsell-i18n
Nov 17, 2026
Merged

sydevs-bot merged 6 commits into
mainfrom
claude/fix-178-upsell-i18n

Conversation

@sydevs-bot

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

Copy link
Copy Markdown
Contributor

Summary

  • Both upsell sentences and the app link text now render through useT(), so the player's message follows the viewer's locale.
  • The eslint-disable no-restricted-syntax region around the block is gone — the blocker it named is resolved.
  • The meditation embed route now asks for the web line, so the copy reaches a visitor rather than only Ladle. That is option B on the question thread, chosen in review.

Change outline

Components — MeditationPlayer's upsell block

The sentence is the translated unit, not the words around the link. Each arm hands t.rich one %{link} node, the shape ErrorFallback already uses for errors.general.status_page_hint.

 MeditationPlayerInner                      components/organisms/MeditationPlayer/MeditationPlayer.tsx
   t = useT()                               # already in scope, two other call sites
-  {/* eslint-disable no-restricted-syntax -- #178: these need keys added first */}
   {upsell && <p>
-    upsell === 'web' ? <>Find more meditations on <Link>wemeditate.com</Link></>
-                     : <>Find interactive … in our <Link>free app</Link></>
+    upsell === 'web' ? t.rich('meditation.general.upsell_web', { link: <Link>{WEMEDITATE_DOMAIN}</Link> })
+                     : t.rich('meditation.general.upsell_app', { link: <Link>{t('…upsell_app_link')}</Link> })
   </p>}
-  {/* eslint-enable no-restricted-syntax */}

Each key is passed as a quoted literal on purpose — tests/guards/translation-keys.test.ts matches a literal first argument, so a computed key would drop both out of the guard that proves they resolve.

Routes — the embed route asks for the line

upsell had no caller, so the translated copy rendered only in Ladle. MeditationTemplate now
forwards the prop, and the embed route sets it:

 MeditationTemplateProps                    components/templates/MeditationTemplate.tsx
+  upsell?: MeditationPlayerProps['upsell']   # forwarded to MeditationPlayer

 Page                                       pages/meditations/[id]/embed/+Page.tsx
   <MeditationTemplate showEmbedButton={false}
+                      upsell="web"

The embed is the one route it belongs on: it runs inside someone else's page, so the link is the
visitor's one way back. On a route of ours it would point at the page they are already reading.

pages/meditations/[id]/embed/Page.test.tsx renders the real template and player, not a stub, so
deleting the player's upsell block fails it too. Named without the + for the reason
pages/map/Page.test.tsx records.

Types — no change

The three keys were already in server/payload-types.ts and lib/translations.en.json. pnpm sync:translations against production reproduces the committed snapshot byte for byte, so nothing was hand-added.

Preview

The story on the Ladle preview — the Web Upsell and App Upsell sections are this change.

Since 3c4b4ff it is also reachable on the site: /meditations/<id>/embed on the branch preview. The per-commit host is deliberately not quoted, because it freezes to one SHA.

The earlier Workers Builds: wemeditate-design failure was not this change. The Ladle build could not load SWC on Workers Builds — filed as #233, fixed on main by #236, which this branch has merged. Both Workers builds, Smoke (ladle) and Smoke (web) were green on 1350180, and f93c0a1 only changed a comment. 3c4b4ff is the first commit since that both builds have to serve.

Also verified against a local Ladle build driven through Playwright: both sections render "Find more meditations on wemeditate.com" → https://wemeditate.com/meditations and "Find interactive meditations with meditation music in our free app" → https://wemeditate.com/app, both opening in a new tab, with no React key warning in the console.

Test results

  • Lean gate: ✓ .claude/skills/pr-prep/check.sh on 3c4b4ff — lint (0 errors), tsc --noEmit, 98 files / 959 tests
  • Targeted specs: 12 passed in components/organisms/MeditationPlayer/, 2 in pages/meditations/[id]/embed/
  • The new spec was confirmed load-bearing: dropping upsell="web" from the route fails it
  • Build: ✓ pnpm ladle:build (exit 0) on f93c0a1. pnpm build N/A — no build/server/Wrangler path touched

Manual verification

  1. Open /meditations/<id>/embed on the branch preview and confirm the line sits under the player, linking to wemeditate.com/meditations. Smoke (web) already fetches that route, but asserts only that it renders bare.
  2. Confirm the full meditation page /meditations/<id> still shows no upsell line.

The locale assertion stays automated in MeditationPlayer.locale.test.tsx.

Notes for reviewer

The link destinations deliberately stay English and absolute. The copy is now locale-aware; the URL is not. That asymmetry is intentional and was checked against the live site rather than inferred: wemeditate.com answers with via: 2.0 heroku-router, so it is the legacy Rails app on its own origin, not this Worker. It localizes its own slugs — /fr/méditations, /de/meditation, /it/meditazioni — a spelling lib/urls.ts cannot derive, and /fr/meditations 404s. Routing these through localeHref would send a French reader to a dead page.

The constant's comment records that, and f93c0a1 adds the trigger it was missing. The repo's own ORIGIN fixtures spell this same domain, so once this app serves wemeditate.com the asymmetry inverts: Link passes an absolute same-origin URL through untouched (#124), and both links become unprefixed self-links in every locale, silently. The shortcut: line names that cutover as the point to route them through localeHref.

The frame editor previews the same route. /meditations/<id>/embed is what SahajCloud's frame editor points at, so an editor placing frames now sees the upsell line too. Left visible: it is what a visitor sees, and hiding it would mean a second condition on previewingThisMeditation. Raised on the question thread for the reviewer to decide.

Dismissed review findings:

  • Collapse the two ternary arms into one t.rich with a looked-up key. Rejected: it makes the key an expression, and translation-keys.test.ts's CALL_PATTERN only sees a quoted literal, so both keys would silently lose their coverage.
  • The track fixture duplicates MeditationPlayer.test.tsx's. Kept: every .locale.test.tsx in the repo inlines its own props, and importing from a sibling test file would pull its describe blocks in.

Contract step skipped. pnpm types:cms was not run: the three fields are already in server/payload-types.ts, and the only upstream drift is unrelated (transcription provider/language), already carried by the open re-sync PR #230.

Detail

Blockers verified by value, not by key name. The ticket warned that closing sydevs/SahajCloud#917 was not sufficient, because its migration declares the keys without filling them, and that a recheck must read the key values. A read of GET /api/globals/wm-web-translations?locale=en&depth=0&select[meditation]=true against cloud.sydevelopers.com returned _status: published with all three keys populated in English. sydevs/SahajCloud#918 is closed.

Fixture pre-mortem. MeditationPlayer.locale.test.tsx's FRENCH fixture assumes %{link} is the placeholder spelling the accessor splits on, and that the three keys sit under meditation.general. Both verified against lib/i18n.ts (RICH_PLACEHOLDER) and the regenerated lib/translations.en.json. The fixture spreads EN_TRANSLATIONS, so it needs no cast and stays valid if WebTranslations gains a required branch.

Why the domain is a constant rather than a literal. wemeditate.com is a brand name carrying no translation key — the upstream description for upsell_web says the placeholder is "a link whose text is the domain wemeditate.com, which stays as it is." Holding it in an identifier also gives the domain one home: it was spelled three times in the first draft, and both hrefs now compose from the constant.

Security review skipped — no changed path matches securityReview.triggerPattern. Docs checked, nothing stale.

Closes #178

🤖 Generated with Claude Code

https://claude.ai/code/session_01Mg9rjWK2gxnsAdExBmBv4o

sydevs-bot and others added 2 commits November 13, 2026 16:51
Both upsell sentences shipped as literal JSX, so every locale read English.
The three keys they need now exist and carry English values on production,
so the eslint-disable region that marked the gap can go.

Each sentence wraps its link, so neither can be assembled from parts. Both
render through t.rich with a %{link} placeholder, the shape ErrorFallback
already uses. The web arm's link text is the domain, which is a brand name
and not copy, so it stays English in a named constant.

Closes #178

Co-authored-by: sydevs-bot <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWK2gxnsAdExBmBv4o
The domain was spelled three times: a constant that deduplicated nothing,
plus both hrefs. Both links now compose from the constant.

Its comment stated the lint mechanism eslint.config.js already owns. It now
states the fact a reader needs instead: wemeditate.com is the legacy Rails
app on another origin, which localizes its own slugs, so lib/urls.ts cannot
spell these links and they stay on the English entry points.

Drops the locale test's no-upsell case. It covers the untouched `upsell &&`
guard rather than the translation wiring, and MeditationPlayer.test.tsx
already owns the render contract.

Co-authored-by: sydevs-bot <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWK2gxnsAdExBmBv4o

@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.

1 question for the reviewer, one per thread.

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


Generated by Claude Code

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 13, 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 3c4b4ff Commit Preview URL

Branch Preview URL
Nov 17 2026, 11:27 PM

@sydevs-bot

sydevs-bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running
CI fix 1

recent dispatches
  • 23:20Z address-review · attempt 1 · session · done
  • 23:20Z address-review · attempt 1 · session
  • 19:39Z address-review · attempt 1 · session · done
  • 19:39Z address-review · attempt 1 · session
  • 19:32Z 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 13, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 13, 2026
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

No fix pushed. Smoke (ladle) reds on a cause outside this diff, already filed as #233.

The check waited out its 12-minute discovery and found no preview. Cloudflare's wemeditate-design build had failed at 16:59:46Z on 75a3335.

Evidence:

  • The same build failed on fix(server): forward the visitor's address to the submissions intake #231's head a7bbc7c six minutes earlier — another branch, another diff.
  • gate passed on this head. It runs pnpm ladle:build and pnpm check:wrangler, so the playground builds from the repo.
  • Nothing merged to main since the last green design build (12e6c37) touches a watched path. git diff --name-only 12e6c37..origin/main lists docs, .mcp.json, scripts/chrome-debug.sh and server/payload-types.ts.
  • Workers Builds: wemeditate-web is green on both heads.

One correction to this PR's body: a zero-second check run is not evidence. The green builds on 12e6c37 report the same way.

Reading the build log needs Cloudflare dashboard access, which this run has none of.

🤖 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 13, 2026
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 13, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 13, 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 3c4b4ff Commit Preview URL

Branch Preview URL
Nov 17 2026, 11:27 PM

@sydevs-bot sydevs-bot moved this from Awaiting to Pending in SYDevelopers Technical Roadmap Nov 15, 2026
@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 diff is the ticket and no larger: two sentences and a link text through t.rich, the eslint-disable region gone, one locale test. The test file clones HeaderDropdown.locale.test.tsx, and %{link} reuses ErrorFallback's shape, so this adds no layer the repo lacked. Holding the keys as quoted literals is right — translation-keys.test.ts's CALL_PATTERN sees only those. Whether anything should set upsell is your call on the open thread; the copy is correct either way.

Findings

  • should-fix — The ## Preview section is stale. Both Workers deployed on 1350180, the Cloudflare comment now carries branch previews, and Smoke (ladle) and Workers Builds: wemeditate-design are green. The body sends you away from the one place this change is visible: the story.
  • should-fix — wemeditate.com may be our own origin, not another's. MeditationPlayer.tsx:43, thread below.
  • consider — MM:SS formatting is now a third copy: MeditationPlayer.tsx:55, AudioPlayer.tsx:80, Playlist.tsx:49. Outside the diff, so no thread.

What was checked

#178 against the diff. Read lib/i18n.ts (RICH_PLACEHOLDER, t.rich), ErrorFallback.tsx:84, translation-keys.test.ts, lib/urls.ts. All three keys are already populated on main, so none was hand-added. Ladder: the constant and the test file are the only new pieces. Whole-file pass over MeditationPlayer.tsx — no literal left and every label goes through t; only formatTime fell out. Drove the Ladle preview with Playwright: both sentences render from translations, no key path leaks, hrefs /meditations and /app.

🤖 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 moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 15, 2026
@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
The constant's comment explained why the two upsell hrefs stay absolute
and English, but named no trigger for revisiting it. A comment recording
an accepted limit without one is the comment that rots.

wemeditate.com is another origin today: a live read answers with
`via: 2.0 heroku-router`, a `_wemeditate_session` cookie and Webpacker
`/packs/` assets, so `Link` treats both hrefs as external and the legacy
app resolves its own localized slugs. The repo's `ORIGIN` fixtures spell
the same domain, so once this app serves it, `Link` passes an absolute
same-origin URL through untouched (#124) and both links silently become
unprefixed self-links for every non-English visitor.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXKDPjLZfsPMpWAzox
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Review addressed. Head is now f93c0a1; the branch was already current with main.

## Preview is stale — adopted. The body now opens with the Ladle story link, and says the earlier wemeditate-design failure was #233, fixed on main by #236.

wemeditate.com may be ours — answered, resolved. It is another origin today, and the repo declares none at all: lib/head.tsx:161 reads the request's. The cutover half had nothing holding it, so f93c0a1 adds a shortcut: naming it.

MM:SS is a third copy — filed as #240. Three files, outside this diff, and Playlist is the copy missing the !isFinite guard.

The upsell wiring question stays open. It is a product call, not a fix.

Lean gate on f93c0a1: lint, tsc --noEmit, 96 files / 954 tests.

🤖 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:49
@sydevs-bot
sydevs-bot requested a review from Ardnived November 15, 2026 19:49
@sydevs-bot
sydevs-bot enabled auto-merge November 15, 2026 19:49
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 15, 2026
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 17, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Working in SYDevelopers Technical Roadmap Nov 17, 2026
The upsell prop had no caller, so the translated copy rendered only in
Ladle. The reviewer chose option B on the open question thread: wire
`upsell="web"` on the embed route rather than leave it unreachable or
make the variant a SahajCloud field.

The embed route is the one place the line belongs. It runs inside
someone else's page, so the link is a visitor's only way back to the
site; on a route of our own it would point at the page they are reading.

The test renders the real template and player, not a stub, so deleting
the player's upsell block fails it too.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYzwqfXrgWbnanUEvS
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Review addressed. Head is now 3c4b4ff. main was 6 commits ahead — merged in 8069277, no conflicts.

B on the upsell question — built, resolved. MeditationTemplate forwards an upsell prop, and pages/meditations/[id]/embed/+Page.tsx sets upsell="web". No other route sets it.

pages/meditations/[id]/embed/Page.test.tsx renders the real template and player, so deleting the player's upsell block fails it too. Confirmed load-bearing: dropping the prop fails it.

Added to #178's acceptance criteria as a review line, and the ## Preview and ## Change outline sections are refreshed — the body claimed no route set the prop.

One thing for you: the SahajCloud frame editor previews this same route, so an editor placing frames now sees the line. Left visible, and raised on the thread.

Lean gate on 3c4b4ff: lint, tsc --noEmit, 98 files / 959 tests.

🤖 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 17, 2026
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 17, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Nov 17, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Pending in SYDevelopers Technical Roadmap Nov 17, 2026
Merged via the queue into main with commit 3cbf796 Nov 17, 2026
37 of 38 checks passed
@sydevs-bot
sydevs-bot deleted the claude/fix-178-upsell-i18n branch November 17, 2026 23:38
@sydevs-bot sydevs-bot moved this from Pending to Done in SYDevelopers Technical Roadmap Nov 17, 2026
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.

fix(i18n): the meditation player's upsell copy stays English

3 participants