feat(parser-react): i18n adapter — locale-file resolution for t()/Trans keys - #10
Merged
officialCodeWork merged 1 commit intoJul 13, 2026
Merged
Conversation
…ns keys
Step 1.4 (TRACKER). Failure mode A2:
- renderedText is now structured: { text, source: jsx|attribute|i18n, key?,
locale?, branch? } — provenance travels into match evidence ('matched
"Membres de l'équipe" (i18n key team.title, locale fr)').
- loadLocaleTable: JSON/YAML locale files via ScanOptions.i18n
{ localeGlobs, defaultLocale }; nested keys flattened; locale inferred
from filename or parent dir; dependency-free mini-glob.
- t('key') / anything.t('key') / <Trans i18nKey> expand to one entry per
locale, so a screenshot in ANY language matches the same component;
i18next namespace: prefixes fall back to the bare key.
- Eval runner: golden.json gains a scan field (per-fixture scan options).
- Fixture a2-i18n-keys (en + fr, t() and Trans): all 5 locale queries green.
- Scorecard: 67 pass / 0 fail / 2 xfail. 49 unit tests.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TRACKER Step 1.4 — failure mode A2, one of the two make-or-break matching gaps for real codebases. Source says
t("team.title"); the Jira screenshot says "Team Members" — or "Membres de l'équipe" when the reporter runs the app in French. Text matching was blind to all of it.What's in it
renderedText— entries are now{ text, source: "jsx" | "attribute" | "i18n", key?, locale?, branch? }. Provenance flows into match evidence:"membres de l'équipe" matched (i18n key team.title, locale fr)— the agent sees why it matched. (branchis reserved for step 1.5.)ScanOptions.i18n { localeGlobs, defaultLocale }loads JSON/YAML locale files (nested keys flattened, locale inferred from filename or parent dir, dependency-free mini-glob).t("key"),i18n.t("key"), and<Trans i18nKey="key">expand to one entry per locale, so a screenshot in any language finds the same component. i18nextnamespace:prefixes fall back to the bare key.golden.jsongains ascanfield the runner passes through toscanReact(also how future fixtures will declareapiWrappers/baseUrls).Eval movement
a2-i18n-keys(en + fr,t()+<Trans>): all 5 locale queries green, including both French ones.Test plan
pnpm evalgate OK; schema regenerated (structured RenderedText), drift gate greenDocumentation
TRACKER.md— 1.4 done, Status → 1.5🤖 Generated with Claude Code