test: enforce shared locale glossary on app i18n catalogs - #2674
Conversation
Content pages and app UI strings share the same screen but had no shared terminology governance (TASK-21172). The glossary now lives in mono content/_system/glossary/; this test enforces its deterministic subset (banned terms, wrong-register verb forms) so new keys can't reintroduce drift like monedero/billetera or tuteo in es-AR.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe change adds glossary-compliance tests for ChangesLocale glossary compliance
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Code-analysis diffPainscore total: 7158.11 → 7158.24 (+0.13) |
🧪 UI test report — ✅ all greenSuites
📊 Coverage (unit)
⏱ 10 slowest test cases
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/i18n/app/__tests__/glossary.test.ts`:
- Around line 15-18: Limit the card.addToWallet.iosStep3 Apple Wallet exemption
to the pt-BR debit/prepaid-card validation rule instead of removing the key
globally through EXCEPTIONS. Update the affected locale-rule checks while
preserving the Apple menu-label allowance and ensuring other rules still
validate this key.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5d863794-5db0-47ed-b7f2-dc22d9e2ce00
📒 Files selected for processing (1)
src/i18n/app/__tests__/glossary.test.ts
- check es-AR resolved (en + es-419 + delta) so new es-419 tuteo strings need a voseo override before reaching Argentine users - scope exceptions per rule (a third-party-UI quote no longer exempts a key from every rule; also drops the prototype-chain 'in' hazard) - \s+ between phrase words (NBSP-proof) and safe accent-dropped variants - add es debit/prepaid card rule, pt-BR circumvention + tu-form bans, and a guard that every non-en locale has rules - extract shared catalog flatten helpers (third copy was being added)
Summary
App UI strings (~2,200 keys × 3 locales) and marketing/content prose sit on the same screen but had no shared terminology governance — terms and register could drift ("monedero" vs "billetera", tuteo leaking into es-AR). The glossary now lives in mono
content/_system/glossary/glossary.{es-419,es-ar,pt-br}.md(extracted from the locale context files). This PR adds the enforcement half: a jest suite that checks the app catalogs against the glossary's deterministic subset — banned terms and wrong-register verb forms.An audit of the current catalogs on dev found zero real violations, so this PR is the test only. Key design points (hardened after automated review):
loadMessages) — a new es-419 string with tuteo needs a voseo override before it reaches Argentine users.card.addToWallet.iosStep3(quotes Apple Wallet's own menu label) is exempt only from the debit/prepaid-card rule.\s+between phrase words) and accept accent-dropped variants where the unaccented form is not a legitimate word in that locale.catalog-helpers.ts(messages/shhhhh tests had two private copies; this PR would have added a third).Task
TASK-21172 — Localization governance: shared glossary + tone (app ↔ content)
Design notes / accepted trade-offs
DeepPartialis now exported frommessages.ts(type-only, no runtime change) so the test can resolve es-AR synchronously.Risks / breaking changes
None — test-only plus one type export. No runtime code touched.
QA
npx jest src/i18n/app/__tests__— 90 tests including 20 glossary checks across es-419 / es-AR / pt-BR. Regexes negative-tested (accented-word boundaries: "vosotros" does not false-positive thevosrule; "Pagas" tuteo does not false-positive the voseo rule).Screenshots: N/A (no visible change)