Repository navigation
fix(i18n): translate announce() live-region strings - #4920
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsFileInput (@astryxdesign/core) · View in Storybook
Lightbox (@astryxdesign/core) · View in Storybook
MultiSelector (@astryxdesign/core) · View in Storybook
Selector (@astryxdesign/core) · View in Storybook
Tokenizer (@astryxdesign/core) · View in Storybook
Typeahead (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: 2 accessibility violation(s) found — 2 serious. FileInput - 1 issue(s)
Tokenizer - 1 issue(s)
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
nynexman4464
force-pushed
the
nynexman4464/fix/i18n-announce-strings
branch
2 times, most recently
from
August 17, 2026 15:26
c5252de to
363bb2c
Compare
MultiSelector, Selector, Typeahead, FileInput, Tokenizer and Lightbox
passed hardcoded English to announce(), so their live-region text stayed
English under an InternationalizationProvider. Route every user-facing
announcement through t() with a per-component catalog key.
Counts are ICU plurals now, not `${n} result${n === 1 ? '' : 's'}`:
a JS-side plural only has the two English forms and cannot be
translated. FileInput's two shapes ("1 file selected: <name>" vs
"N files selected") fold into one message with an ICU `=1` branch,
since naming the file is an exactly-one case, not a plural category.
Live-region assertions now resolve their expected text from the shipped
catalog, and MultiSelector, Typeahead and FileInput each gain a
pseudo-locale test that fails if an announcement is hardcoded again.
no-hardcoded-i18n-string carried three grandfathered strings while the
i18n sweep ran. All three are gone from the codebase now ('Copied' with
the CodeBlock migration, the other two with the previous commit), so the
exemption has nothing left to exempt.
The call-argument branch hand-rolled its literal detection and only
recognized a bare string or an expression-free template, so
announce(cond ? 'A' : 'B') and announce(`${n} results`) — the shapes the
hardcoded announcements actually took — were never flagged. It now
reuses reportUserFacingLiteralsIn, the walk the aria-label path already
uses, which covers ternaries, ?? / || fallbacks and template chunks.
Kept separate from the sweep so it can be dropped on its own.
The announce() tests added with this PR resolved their expected text from
the same catalog the component reads. `enMessage('@astryx.multiSelector.
selectionCleared')` is literally 'Selection cleared', so those assertions
passed against hardcoded English too — they proved the arguments were
wired, not that anything was localized. The pseudo-locale twins did prove
resolution, but only because the vitest global setup generates
locales/pseudo.json, a gitignored build artifact.
Use the pattern the suite already had: render inside an
InternationalizationProvider whose `overrides` supply the expected string,
then assert that string. The assertion then depends on no catalog, and it
proves the component looked up that key, passed those arguments, and let
the resolver format the result.
Count messages keep their ICU plural in the override, so the singular and
plural branches are still each asserted; FileInput's `=1` branch names the
file and its `other` branch is asserted not to. Announcement presence and
absence checks (announce('') clearing, "does not announce until the user
searches") involve no catalog and are unchanged.
Both local helpers, and the en.json / pseudo.json / IntlMessageFormat
imports they needed, are gone.
nynexman4464
force-pushed
the
nynexman4464/fix/i18n-announce-strings
branch
from
August 17, 2026 22:38
363bb2c to
785e01e
Compare
nynexman4464
marked this pull request as ready for review
August 17, 2026 22:38
31 of 40 tasks
This branch was successfully deployed
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.
Finishes the
announce()half of the i18n sweep started in #4387.What changed
announce()inpackages/corenow resolves through the message catalog: selection counts, search result counts, empty-search results, file selections, token add/remove, and Lightbox position. Under anInternationalizationProviderthese were the last part of the UI still speaking English.${n} result${n === 1 ? '' : 's'}. A JS-side plural carries only the two English forms and cannot be translated at all; the new keys follow the shape already established by@astryx.commandPalette.resultCount. FileInput's two shapes ("1 file selected: " vs "N files selected") fold into a single message with an ICU=1branch, because naming the file is an exactly-one case rather than a plural category.allowedCalleeStringsallowlist is gone. It was added alongside the check in lint: flag hardcoded strings passed to announce() #4387 with a note to delete it once the sweep landed;'Copied'had already gone stale when CodeBlock migrated.announce(cond ? 'A' : 'B')andannounce(`${n} results`)— exactly what these announcements looked like — were never flagged. It now reusesreportUserFacingLiteralsIn, the same walk thearia-labelpath uses. That is the last commit and can be dropped on its own if reviewers would rather land it separately.Verification
InternationalizationProvideroverridesentry — the pattern the suite already used elsewhere. No assertion depends on a catalog, so each one proves the component looked up that key, passed those arguments, and let the resolver format the result. Count messages keep their ICU plural in the override, so the singular and plural branches are each still asserted, and FileInput's=1branch is asserted to name the file where itsotherbranch is asserted not to.expected '1 of 3 selected' to be '1 sur 3 sélectionnés'. All 454 tests across the six suites and the i18n suites pass with the fix in place.packages/core/src. Run against unmodifiedmainit flags exactly the sites this PR fixes — nothing further to scope.${n} ${n === 1 ? 'result' : 'results'}) is still invisible to the rule. It is fixed here by hand.