fix(i18n): resolve cross-namespace keys via root translator (../ never worked)#688
Open
shukiv wants to merge 1 commit into
Open
fix(i18n): resolve cross-namespace keys via root translator (../ never worked)#688shukiv wants to merge 1 commit into
shukiv wants to merge 1 commit into
Conversation
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.
Bug
Several components call
t('../namespace.key')(ort('../../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_spaminstead 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.tsx—context_menu.not_spam(button title) + 5email_viewer.spam.*toastscomponents/settings/account-settings.tsx— 3×common.unknowncomponents/settings/about-data-settings.tsx—settings.import_success/import_error/save_successNo string/key changes; every target key already exists at its absolute path.
Testing
tscclean; lint clean (no new warnings)