Page MenuHomePhabricator

i18n: use new composable for string props inside components
Closed, ResolvedPublic3 Estimated Story Points

Description

T368442 will add a new composable that returns an i18n function. This task covers updating components to use the new composable for relevant string props so those strings could be translated.

There are 2 types of string props we'll be updating:

  1. Those that cover strings that could feasibly need to be customized by the dev user. For these strings, the prop should not be removed, so users can still provide a custom string.
  2. Those that never need to be customizable, such a specific a11y text that describes functionality and is feature-agnostic. These props can be removed altogether.

The following props are affected:

ComponentPropAllow customization?Notes
ChipInput, InputChipchipAriaDescriptionNoRemove
DialogcloseButtonLabelYesAdd boolean useCloseButton prop, eventually set closeButtonLabel default to English fallback
Field, LabeloptionalFlagNoAdd boolean optional prop, eventually set optionalFlag default to English fallback
MessagedismissButtonLabelYesAdd allowUserDismiss prop, eventually set dismissButtonLabel default to English fallback
SearchInputbuttonLabelYesAdd boolean useButton prop, eventually set buttonLabel default to English fallback
TableselectAllLabelNoRemove
TableselectRowLabelNoRemove
TablesortCaptionNoRemove
TableOthers related to paginationTBDTBD
TypeaheadSearchsearchResultsLabelNoRemove
TypeaheadSearchbuttonLabelYesAdd useButton prop, eventually set buttonLabel default to English fallback

Acceptance criteria

  • All of the above components are updated to use the new composable and change props as necessary
  • The old API still works (i.e. this is not a breaking change)
  • Future breaking changes are noted inline in component code referencing T368444

Event Timeline

AnneT set the point value for this task to 5.Jun 25 2024, 7:28 PM

Change #958567 had a related patch set uploaded (by Anne Tomasevich; author: Catrope):

[design/codex@main] ChipInput, InputChip: Remove chipAriaDescription prop, replace with i18n

https://gerrit.wikimedia.org/r/958567

Change #1049569 had a related patch set uploaded (by Anne Tomasevich; author: Anne Tomasevich):

[design/codex@main] Message: Add useI18n and update dismissButtonLabel prop

https://gerrit.wikimedia.org/r/1049569

Change #1050681 had a related patch set uploaded (by LWatson; author: LWatson):

[design/codex@main] i18n, TypeaheadSearch: replace `searchResultsLabel` prop with i18n

https://gerrit.wikimedia.org/r/1050681

Change #1050708 had a related patch set uploaded (by LWatson; author: LWatson):

[design/codex@main] TypeaheadSearch: add `useButton` prop, set `buttonLabel` fallback

https://gerrit.wikimedia.org/r/1050708

Few things:

  1. The open patches will need to be rebased on top of https://phabricator.wikimedia.org/T368449
  2. Per our TypeaheadSearch guidelines (specifications and best practices), we strongly discourage customizing the button label and encourage the label to be "Search" or its appropriate translation. Should we continue to allow customization if it goes against our guidelines?

Change #1050725 had a related patch set uploaded (by Catrope; author: Catrope):

[design/codex@main] Dialog: Use i18n, add `useCloseButton` prop

https://gerrit.wikimedia.org/r/1050725

Change #1050800 had a related patch set uploaded (by LWatson; author: LWatson):

[design/codex@main] Table: replace string props with i18n

https://gerrit.wikimedia.org/r/1050800

  1. Per our TypeaheadSearch guidelines (specifications and best practices), we strongly discourage customizing the button label and encourage the label to be "Search" or its appropriate translation. Should we continue to allow customization if it goes against our guidelines?

I think it's best if we continue to allow a custom label for the search button in TypeaheadSearch, just to offer some flexibility in case it's needed on some wiki/skin in the future. I'd recommend we migrate the search button label props in both SearchInput and TypeaheadSearch as noted in the table in the task, but I don't think we should use the useI18n composable inside TypeaheadSearch - we can just pass the buttonLabel into SearchInput, if that prop has been used, and if not, we'll use useI18n inside SearchInput to get the default button label.

Change #1050681 merged by jenkins-bot:

[design/codex@main] TypeaheadSearch: replace `searchResultsLabel` prop with i18n

https://gerrit.wikimedia.org/r/1050681

Change #1050800 merged by jenkins-bot:

[design/codex@main] Table: replace string props with i18n

https://gerrit.wikimedia.org/r/1050800

Change #1050725 merged by jenkins-bot:

[design/codex@main] Dialog: Use i18n, add `useCloseButton` prop

https://gerrit.wikimedia.org/r/1050725

Change #958567 merged by jenkins-bot:

[design/codex@main] ChipInput, InputChip: Remove chipAriaDescription prop, replace with i18n

https://gerrit.wikimedia.org/r/958567

Change #1049569 merged by jenkins-bot:

[design/codex@main] Message: Add useI18n and update dismissButtonLabel prop

https://gerrit.wikimedia.org/r/1049569

Change #1051451 had a related patch set uploaded (by LWatson; author: LWatson):

[design/codex@main] Field, Label: add i18n translatable strings

https://gerrit.wikimedia.org/r/1051451

Change #1050708 merged by jenkins-bot:

[design/codex@main] TypeaheadSearch, Search Input: add `useButton` prop

https://gerrit.wikimedia.org/r/1050708

Change #1051451 merged by jenkins-bot:

[design/codex@main] Field, Label: use i18n, add `optional` prop

https://gerrit.wikimedia.org/r/1051451

Change #1051826 had a related patch set uploaded (by Anne Tomasevich; author: Anne Tomasevich):

[design/codex@main] docs: Standardize descriptions of props with default strings

https://gerrit.wikimedia.org/r/1051826

Change #1051826 merged by jenkins-bot:

[design/codex@main] docs: Standardize descriptions of props with default strings

https://gerrit.wikimedia.org/r/1051826

Change #1053677 had a related patch set uploaded (by VolkerE; author: VolkerE):

[mediawiki/core@master] Update Codex from 1.8.0 to 1.9.0

https://gerrit.wikimedia.org/r/1053677

Change #1053677 merged by jenkins-bot:

[mediawiki/core@master] Update Codex from 1.8.0 to 1.9.0

https://gerrit.wikimedia.org/r/1053677