Skip to content

fix(i18n): resolve cross-namespace keys via root translator (../ never worked)#688

Open
shukiv wants to merge 1 commit into
bulwarkmail:mainfrom
shukiv:fix/i18n-cross-namespace
Open

fix(i18n): resolve cross-namespace keys via root translator (../ never worked)#688
shukiv wants to merge 1 commit into
bulwarkmail:mainfrom
shukiv:fix/i18n-cross-namespace

Conversation

@shukiv

@shukiv shukiv commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Bug

Several components call t('../namespace.key') (or t('../../namespace.key')) to reach a key in a different top-level namespace. next-intl has no relative (../) namespace navigation — the string is treated as a literal key inside the current namespace, isn't found, and next-intl returns the raw fallback.

Most visible case: the bulk Not spam toolbar button in the junk folder shows a tooltip of literally email_list.../context_menu.not_spam instead of the translated label. The batch spam/undo-spam toasts and a few settings strings hit the same bug (less visible because they're transient or English-only fallbacks that happen to read fine).

Fix

Resolve cross-namespace keys through a root translator (useTranslations() with no namespace) and reference the key by its absolute path — no ../.

Affected call sites:

  • components/email/email-list.tsxcontext_menu.not_spam (button title) + 5 email_viewer.spam.* toasts
  • components/settings/account-settings.tsx — 3× common.unknown
  • components/settings/about-data-settings.tsxsettings.import_success / import_error / save_success

No string/key changes; every target key already exists at its absolute path.

Testing

  • Junk folder → select messages → Not spam tooltip now shows the translated label (e.g. Hebrew "לא ספאם") instead of the raw key
  • Batch mark-as-spam / not-spam toasts show real text
  • Settings → Account "Unknown" placeholders and About → import/reset alerts localize correctly
  • tsc clean; lint clean (no new warnings)

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