fix(react): stop the i18n gate flagging key caps and icon glyphs - #5269
fix(react): stop the i18n gate flagging key caps and icon glyphs#5269sauldom102 wants to merge 1 commit into
Conversation
Five of the 133 tracked strings are not product copy at all, and would sit in the baseline forever. `<kbd>Enter</kbd>` is a key cap: it reads what is printed on the key, and the sentence around it is already translated separately (`F0AiChatTextArea` pairs it with `ai.clarifyingQuestion.navHint.select`). That generalises, so it is a rule rather than a marker: text directly inside `<kbd>`, `<code>`, `<pre>`, `<samp>` or `<var>` is machine or device text. Only the immediate parent counts — a `<kbd>` inside a sentence must not silence the sentence, which the tests pin down. The other three are one-offs and get inline markers: the "AD" in AudioDescriptionToggleIcons is a glyph inside the icon artwork, like the CC badge, and "XRay" names the dev-only inspector overlay. Baseline 133 -> 128. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
🔍 Review policy: Code changeDefault rule: any other change needs one approval from f0-devs (rule 4). Required approvals
How this was decided
Policy source: |
✅ No untranslated copy addedEvery user-visible string in this PR comes from the i18n layer. Codebase total unchanged at 128. |
✅ No New Circular DependenciesNo new circular dependencies detected. Current count: 0 |
✅ Storybook docs — no pages lostEvery page reachable on Links point at this PR's Storybook build — browse the full Storybook. Snapshot of the Storybook index (docs pages + stories) compared against |
🔍 Visual review for your branch is published 🔍Here are the links to: |
📦 Alpha Package Version PublishedUse Use |
✅ No breaking public API changesNo public exports were removed, renamed, or had existing props/types changed in a breaking way compared to Comparing
|
♿ Accessibility (axe) — components changed in this PR✅ No a11y issues in the stories this PR changed. Scope: only stories in the files/component folders this PR changed. It can't yet flag downstream ripple from shared-code/token changes, or diff against |
Coverage Report for packages/react
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
Description
Follow-up to #5262. Five of the 133 tracked strings are not product copy at all — a key cap, two icon glyphs and the name of a dev-only overlay. Left alone they would sit in the baseline forever, so this removes them: one as a general rule, three as inline markers. Baseline 133 → 128.
Type of change
Implementation details
fix: skip text directly inside
<kbd>,<code>,<pre>,<samp>and<var>Why this is a rule and not three more markers
F0AiChatTextArearenders<kbd>Enter</kbd> {i18n.ai.clarifyingQuestion.navHint.select}. The cap reads what is printed on the physical key; the sentence beside it is already translated. That is a property of<kbd>, not of these two lines, so the next component to render a shortcut hint should not have to rediscover the marker. The other four elements hold code, sample output and variable names, which are not translated either.Only the immediate parent counts. A
<kbd>nested inside a translated sentence must not silence the sentence, and prose under a<pre>is a markup bug rather than something to hide. Both are pinned by tests:fix: mark the
ADicon glyphs and theXRayoverlay titlei18n-exemptWhy these three stay literals
AudioDescriptionToggleIconsdrawsADas<text>inside the SVG — it is part of the icon artwork, the same wayCCis on a closed-captions badge, not a label beside it. SVG<text>does legitimately carry copy elsewhere (chart labels), so this cannot be a blanket rule and takes a marker.lib/xray.tsxis the dev-only component inspector, rendered behind anenabledflag;XRayis its name.chore: regenerate the baseline (133 → 128)
test: cover the element rule, including the two cases that must still be flagged
Notes for reviewers
No behaviour change: the three source edits are JSX comments, and the element rule only affects what the scanner reports. Adds no translation keys, so no API-surface impact.
tscclean, format clean, 101 script tests pass, and the touched components' suites pass (55 files / 710 tests).Conflicts with #5266 on
untranslated-copy-debt.jsononly — both regenerate it. Whichever lands second needspnpm --filter @factorialco/f0-react run check:untranslated-copy --update, which is the whole resolution since the file is generated.After this and #5266, the remaining 101 findings all need new translation keys, which
check-api-surface.tsclassifies as breaking (TranslationShapemarks every key required). That is a public-API call rather than a mechanical cleanup, so I have not opened PRs for it.🤖 Generated with Claude Code