Skip to content

feat(parser-react): i18n adapter — locale-file resolution for t()/Trans keys - #10

Merged
officialCodeWork merged 1 commit into
developmentfrom
build/phase-1/step-1.4-i18n-adapter
Jul 13, 2026
Merged

feat(parser-react): i18n adapter — locale-file resolution for t()/Trans keys#10
officialCodeWork merged 1 commit into
developmentfrom
build/phase-1/step-1.4-i18n-adapter

Conversation

@officialCodeWork

Copy link
Copy Markdown
Owner

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

  • Structured 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. (branch is reserved for step 1.5.)
  • Locale tableScanOptions.i18n { localeGlobs, defaultLocale } loads JSON/YAML locale files (nested keys flattened, locale inferred from filename or parent dir, dependency-free mini-glob).
  • Key expansiont("key"), i18n.t("key"), and <Trans i18nKey="key"> expand to one entry per locale, so a screenshot in any language finds the same component. i18next namespace: prefixes fall back to the bare key.
  • Per-fixture scan optionsgolden.json gains a scan field the runner passes through to scanReact (also how future fixtures will declare apiWrappers/baseUrls).

Eval movement

  • New fixture a2-i18n-keys (en + fr, t() + <Trans>): all 5 locale queries green, including both French ones.
  • Scorecard: 67 pass / 0 fail / 2 xfail / 0 unexpected-pass · precision 1.000 · recall 0.889 · match accuracy 1.000.

Test plan

  • 49 unit tests green (5 new: per-locale expansion, Trans resolution, cross-locale matching, evidence provenance, unconfigured no-op)
  • pnpm eval gate OK; schema regenerated (structured RenderedText), drift gate green

Documentation

  • TRACKER.md — 1.4 done, Status → 1.5

🤖 Generated with Claude Code

…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>
@officialCodeWork
officialCodeWork merged commit 4b4fd9e into development Jul 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants