Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: localization issue in Legends: support callback to get localized overflow string #32849

Open
1 task done
fpintos opened this issue Sep 17, 2024 · 0 comments
Open
1 task done

Comments

@fpintos
Copy link
Member

fpintos commented Sep 17, 2024

Library

React Components / v9 (@fluentui/react-components)

Describe the feature that you would like added

This is in react-charting.

Legends uses overflowText to produce an overflowString and then it assumes that ${items.length} ${overflowString} should be used as aria-label and text for the button. See

This is not correct for all languages. In English, it is natural to say "3 more", but in Portuguese it is more natural to say "mais 3" instead of "3 mais" (even thou both are correct). There are languages that the number and the noun that follows it can change depending on factors like gender, case, or plurality, so the library needs to account for that.

Suggestion: allow components to pass a callback function to overflowText as overflowText: string | (count: number) => string, (or use a new property for the function) then call this function passing items.length and use the returned string as aria label and button text. The application is then responsible for the full formatting of that string, based on the given count.

Have you discussed this feature with our team

No response

Additional context

No response

Validations

  • Check that there isn't already an issue that requests the same feature to avoid creating a duplicate.

Priority

None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants