Skip to content

fix(MultiSelector): translate the default count text - #9017

Closed
HelloOjasMutreja wants to merge 2 commits into
meta:mainfrom
HelloOjasMutreja:fix/multiselector-count-i18n
Closed

HelloOjasMutreja wants to merge 2 commits into
meta:mainfrom
HelloOjasMutreja:fix/multiselector-count-i18n

Conversation

@HelloOjasMutreja

Copy link
Copy Markdown
Contributor

Fixes #8980.

With triggerDisplay="count" and no formatValue, the trigger text was the literal template ${n} selected, so it read "2 selected" under every locale and had no plural forms. The component's other strings, including the selection-count announcement, already go through t().

The default text now comes from a new message, @astryx.multiSelector.triggerCount ({count, number} selected), with count as a parameter so a locale can add plural forms. formatValue still replaces it, and English output is unchanged. Only en.json gains the key; other locales fall back to English until translated, as for any new message, and the catalog check passes.

Tests: a new case renders under a French override with a plural message and expects "2 sélectionnés"; it fails against the old literal. Typecheck, eslint, check:i18n-catalog and the changeset coverage check pass locally. One MultiSelector test, "uses a bottom sheet and stays open while toggling options", fails locally with and without this change.

This is a text change, so there is no before/after image.

@vercel

vercel Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 30, 2026 5:36pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 30, 2026
@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run concluded failure. Current analysis is unavailable.

The exact-head preview is not available yet.


Generated by PR Enrichment workflow | View current CI run

@astracat-bot

astracat-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Oct 30, 2026, 9:10 PM UTC

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for moving the count text into the catalog; changes are requested before this lands. The English message {count, number} selected makes count a plain number, and the catalog check (check:i18n-catalog) rejects any shipped translation that turns it into a plural, so the plural forms the changeset promises can only come from app overrides: adding your test's own French message to fr-FR.json fails that check. Declaring the source as {count, plural, one {# selected} other {# selected}} keeps the English output identical and lets translators supply plural forms. Please also correct the changeset's "English output is unchanged" (1,200 selections now read 1,200 selected, and untranslated locales use their own digits) and refresh the formatValue @default in the JSDoc.

[Automated review]

"description": "Polite screen-reader announcement of how many MultiSelector options are selected out of the total, spoken after each toggle. Live-region text, never shown on screen; example: `3 of 12 selected`."
},
"@astryx.multiSelector.triggerCount": {
"defaultMessage": "{count, number} selected",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{count, number} gives count a number contract, so check:i18n-catalog rejects a shipped translation that adds plural forms. Your test's French message fails it in fr-FR.json with argument "count" has incompatible kind: expected number; found plural. A plural source keeps the English output identical and lets translators pluralize:

"defaultMessage": "{count, plural, one {# selected} other {# selected}}",

@HelloOjasMutreja

Copy link
Copy Markdown
Contributor Author

Pushed the three changes:

  • @astryx.multiSelector.triggerCount is now {count, plural, one {# selected} other {# selected}}, so English reads the same and a shipped translation can supply plural forms. check:i18n-catalog still passes.
  • The changeset no longer says English output is unchanged: it now notes that the count is formatted for the locale (1,200 selections read "1,200 selected") and that the message is declared as a plural.
  • The formatValue @default in the JSDoc now describes the translated triggerCount text instead of the old template literal.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the follow-up; changes are still requested before this lands. The latest commit put the plural form on TableSelectionToolbar's @astryx.table.selection.selectedCount (line 831 of en.json) rather than on @astryx.multiSelector.triggerCount (line 1647), which is still {count, number} selected, so shipped MultiSelector translations still cannot add plural forms and Table translations must now be plural. Please restore {count, number} selected on the Table key and declare triggerCount as {count, plural, one {# selected} other {# selected}}; the changeset's plural sentence is then accurate. The formatValue JSDoc and the changeset's number-formatting note are already fixed.

[Automated review]

},
"@astryx.table.selection.selectedCount": {
"defaultMessage": "{count, number} selected",
"defaultMessage": "{count, plural, one {# selected} other {# selected}}",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rewrites TableSelectionToolbar's selectedCount, not the MultiSelector message: @astryx.multiSelector.triggerCount (line 1647) is still {count, number} selected, so a French plural translation of it still fails check:i18n-catalog, while a number-shaped Table translation now fails instead. Restore {count, number} selected here and put the plural on line 1647:

"defaultMessage": "{count, plural, one {# selected} other {# selected}}",

@HelloOjasMutreja

Copy link
Copy Markdown
Contributor Author

Closing as a duplicate: #9020 landed the same MultiSelector count text fix on main.

@HelloOjasMutreja
HelloOjasMutreja deleted the fix/multiselector-count-i18n branch October 31, 2026 07:12

This branch was successfully deployed

1 active deployment
Preview — 9d81f951 Deployed Oct 30, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] MultiSelector: the count trigger text "N selected" is hard-coded English

1 participant