Repository navigation
refactor(i18n): screen-reader strings live in the repo, machine-translated - #456
Conversation
…lated The thirteen keys the widget only ever speaks — the calendar arrows and date input, the drawer toggle, the loading spinners, the settings cog, the carousel's photo and pause buttons, the filter chip's remove button, the results announcement, the nearby prompt's dismiss button and the share buttons — move out of SahajCloud's sy-atlas-translations into src/config/a11y/<locale>.json, renamed to <group>.a11y.<key>. English is the source; every other SahajCloud locale is machine-translated, and a11y.test.ts refuses a missing locale, key or placeholder. English is mounted into the boot resource. Every other locale's file is a lazy chunk that translationsQuery mounts onto its SahajCloud bundle, so the cache, the warm-up and applyLocale hold one tree and the eager payload stays inside its budget. A chunk that fails to load is reported and leaves those keys to English rather than the whole language. The snapshot drops the thirteen old keys, as the sync will once SahajCloud removes them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The mechanics are clean and the classification holds: all 13 keys trace to an aria-label, srLabel, closeLabel or an sr-only region, none with a second visible sink. What the code does not explain is why they had to move. SahajCloud already has a first-class a11y sub-group for screen-reader-only copy — collapsed, labelled "Accessibility" — in 10 wm-web-translations tabs and zero Atlas ones. Adopting it there answers the stated problem with no module, no 19 files, no lazy chunk, no two-repo deploy order, and keeps human translators on the copy blind users hear. That makes most of this diff unnecessary, so settle it first. It also claims a11y as a repo-owned key segment while that is already the producer's slug for the same concept; views/shared.tsx:199 shows the cost — one button's two aria-labels, now one human and one machine.
Findings
blocker— the approach →a11y.ts:14should-fix— snapshot hand-edited;RETIRING_KEYSexists →translations.en.json:2should-fix— Streamline: unreachable base-tag branch →a11y.ts:51consider— Streamline:A11yStrings→a11y.ts:17consider— deaddefaultValueguards →views/fallbacks.tsx:264
What was checked
Read whole: a11y.ts, a11y.test.ts, en.json, context.json, fetch.ts's translation region, locale.ts, i18n.ts, i18next.d.ts, translations.test.ts, 19 call sites; producer translationsField.ts, both schemas. Verified that no old key survives, that preferredLocale narrows the tag, that Config['locale'] covers every offered locale, and that the change outline, the contract claims and the CSP row match the diff. Streamliner: 8 pieces, 5 kept, 2 posted; dropped folding getLocaleBundle into getTranslations, which conflates the wire fetcher wire.test.ts pins. No question threads. Profile read.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`src/config/translations.en.json` is generated by `pnpm sync:translations`, and deleting the 13 keys by hand pre-empts the sync that drops them. A sync run before sydevs/SahajCloud#1246 deploys would re-add them, and the snapshot's reverse direction would then fail naming 13 keys nothing references. `RETIRING_KEYS` already owns this window: a key leaves the app a whole release before it can leave the snapshot. Restore the generated file and name all 13 there, against the SahajCloud ticket that removes them. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjW5ZKbJZHBcppnaY8H
`a11yFileFor`'s base-tag fallback was a third copy of a narrowing `preferredLocale` has already done: it resolves a requested tag against the offered set before the bundle is keyed (`config/i18n-options.ts`), and `a11y.test.ts` requires a file for every locale that set can hold. The only tag that reaches the branch is a verbatim `?locale=de-AT`, whose query key `applyLocale` never reads. Fold the lookup into `loadA11yStrings`. The exact file and the English fallback are unchanged, and the two surviving cases cover both. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjW5ZKbJZHBcppnaY8H
Nothing imported it, and `EN_A11Y: A11yStrings = en` annotated what `typeof en` already infers. `MountedA11y` was its one reader, so it maps over `typeof en` directly. The module prose moves to a file header, where it was describing the module rather than the alias. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjW5ZKbJZHBcppnaY8H
`common.a11y.loading` cannot miss. `config/i18n.ts` mounts `EN_A11Y` into the boot
resource, and `a11y.test.ts` refuses a missing or blank value in any locale's file,
so each guard was unreachable — and the three spelled it three ways ("Loading…",
"Loading", "Loading…"), which only a dead guard can get away with.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjW5ZKbJZHBcppnaY8H
`Spinner` renders `srLabel` only under `!label && !decorative`, so a decorative spinner inside an `aria-hidden` curtain announced nothing — the comment above it says that is the intent. Translating a string nothing reads was the last reason this module called `useTranslation`. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjW5ZKbJZHBcppnaY8H
Review addressedFour adopted, one back to you. Adopted
Open — yours to settle
Lean gate green. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
sahajatlas-design | c776345 | Nov 21 2026, 04:29 AM |
sydevs-bot
left a comment
There was a problem hiding this comment.
Approved for Ardnived, who wrote it: GitHub refuses an author's own approval. CI is green and the automated review has run. Enable auto-merge when you want it merged: the queue tests it against its base. 🤖 Written by the sydevs autonomous loop — see what this is
sydevs/SahajCloud#1268 serves the inline embed's three strings and no longer serves `compact.open`, so a full `pnpm sync:translations --write` runs clean here. The hand-added `common.map.expand`, `common.map.close` and `countries.place_title` already matched production byte for byte. The sync also drops the thirteen screen-reader keys SahajCloud#1246 removed, which `RETIRING_KEYS` held since #456 moved them into `src/config/a11y/`; their entries go with them. `common.errors.captcha_blocked` stays retiring until SahajCloud#1278. `pnpm types:cms` wrote no change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
sy-atlas-translationsintosrc/config/a11y/<locale>.json, under new<group>.a11y.<key>names. They are machine-translated into every SahajCloud locale, and any key added later gets translated in the PR that adds it. Translators no longer see these strings, and a new one needs no SahajCloud change.translationsQuerymounts onto that locale's SahajCloud bundle. The eager payload stays withinpnpm size.common.chrome.close,filters.*.label,widget_label) stays there.Change outline
Contract impact
script-srcalready covers.CHANGELOG.mdand thescript-srcrow indocs/embedding.mdsay so.pnpm sync:translationsreproduces this PR's snapshot.src/types/payload/is untouched. The nextpnpm types:cmsafter SahajCloud#1246 drops the keys fromSyAtlasTranslation, and since every key in that type is optional,satisfieskeeps holding.Test results
.claude/skills/pr-prep/check.sh --full: lint, typecheck, the unit lane, the build andpnpm size(within budget).pnpm sizeare CI's.dist/assets/de-*.jsholds the German strings, outside the eager graph.calendar.nextfromfr.jsonand dropping%{platform}fromshare.share_onturn twoa11y.test.tscases red, and the newtranslationsQueryspec fails with the mount reverted.Manual verification
/?locale=de, open the calendar, and inspect the arrow buttons. Theiraria-labels should read "Zurück" and "Weiter".de-*.jschunk.Notes for reviewer
a11ygroup in SahajCloud. I found them by tracing everyt()call into anaria-label,srLabel,closeLabelorsr-onlysink, then dropped any key that also renders as visible text.Поделиться: %{platform}.🤖 Generated with Claude Code