Skip to content

feat(i18n): extract redux notice messages (batch 2)#1153

Open
JamieRuderman wants to merge 2 commits into
i18n/extract-shellfrom
i18n/extract-notices
Open

feat(i18n): extract redux notice messages (batch 2)#1153
JamieRuderman wants to merge 2 commits into
i18n/extract-shellfrom
i18n/extract-notices

Conversation

@JamieRuderman

Copy link
Copy Markdown
Member

Summary

Batch 2 of Phase 4 extraction: the redux model notice messages — the success/error/notice toasts dispatched from dispatch.ui.set({ successMessage / errorMessage / noticeMessage }) across 16 model files. 60 messages → 65 keys in the notices namespace, fully translated to ja/de/es.

Since these run in non-React model code, they call the shared i18n instance directly: i18n.t('notices:key', { ...vars, defaultValue }).

Stacked on i18n/extract-shell (#1152) because it depends on that branch's parser fix. Once #1152 merges to feature/i18n, I'll retarget this PR — the diff here is notices-only.

Highlights — the pitfalls the plan called out, handled

  • Pluralization — replaced hand-rolled ternaries (device${n>1?'s were':' was'}) with i18next count plurals (_one/_other). This also fixes an English bug: the old code rendered "1 devices were…"; it now correctly says "1 device was…". Verified at runtime across locales (German inflects the verb too: "wurde" vs "wurden"; Japanese uses its single form).
  • Interpolation, never concatenation — every ${name}/${email}/${error} became a {{placeholder}}; string-built messages ('Update phone error: ' + error.message) collapsed into one keyed call.
  • Word order — the possessive ${who} ${plan} subscription updated (where who was 'Your' or `${email}'s`) was split into two keys (subscriptionUpdatedYours / subscriptionUpdatedOther) so each language renders possession naturally rather than forcing English 's.
  • Conditional nounsthat ${isService ? 'service' : 'device'} split into two keys.
  • Not translated — API/dynamic values (device names, emails, error.message) stay as runtime interpolation values.

Tooling fix (separate commit)

Made i18n:check plural-aware. Plural keys expand per-locale via CLDR (Japanese: _other only; English/German: _one+_other; Spanish also _many), so strict key-equality would wrongly flag Japanese as "missing" _one. The check now compares plural bases against each locale's own Intl.PluralRules categories.

Verification

  • i18n:check passes (plural-aware) — 4 locales × 3 namespaces, no missing/dead keys, no empty English.
  • tsc clean; production build passes.
  • Placeholder parity verified programmatically across en/ja/de/es (zero mismatches).
  • Runtime plural resolution spot-checked: count=1 vs 5 renders the correct grammatical form in every language.

🤖 Generated with Claude Code

@JamieRuderman

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: da305b2d45

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

1 participant