-
Notifications
You must be signed in to change notification settings - Fork 843
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
[Data Grid] Pluralization of sort button #5043
[Data Grid] Pluralization of sort button #5043
Conversation
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
To the reviewer, not sure if I need to add any tests for this change. I didn't see any test checking the text of the sort button after sorting a column, so I assumed it was not needed. Let me know if you need me to implement a test for this change. |
Thanks for opening this PR! 🎉 Let me get our CI running our tests, build a preview, and then I can start a review: jenkins test this. |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5043/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @babs20! Tested, looked at the code, and LGTM! 🎉
I don't think we need tests for this but let me confirm with @chandlerprall.
Thank you for the change, @babs20 ! Some languages have different rules instead of 1 vs 0 or 2+; e.g. pluralization for 2 items is different than 3 items, and we may need to try and account for that. Let me track down some more information before we move forward with this change. It would be great to have a new test covering this change; but I'll research this first. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of concatenating / performing the pluralizing logic in the template string, we can move it into the i18n token itself which will allow applications full control over how they want to localize/translate:
The Interpolation example shows how the value can be included in the token default
s, but it will require a small refactor because our i18n utility doesn't support passing values to more than one tokens. Instead of nesting EuiI18n, that render prop function can be replaced by our useEuiI18n hook (also in that Interpolation section).
As an additional reference, color_picker_swatch.tsx:32 has an instance of useEuiI18n with a value.
Let me know if any of that doesn't make sense or isn't clear how to implement.
After looking over this again, I believe I misunderstood the I will go back and take a look at this again. |
I missed mentioning that the token's default can be a function and hold that extra logic. Something like:
Which keeps all of the token definitions in the localization system, and ensures |
Ahhh, I got it now. Thanks for the clarification! |
@cchaos Thanks a million for getting the merge upstream on this PR! 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM, will merge when CI passes
Thanks for the fix & unit test @babs20 !
jenkins test this |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5043/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5043/ |
Summary
Fixes #5037
Updated the
EuiDataGrid
sort button text to include pluralization of the text when fields are sorted.Before:
After:
Checklist
- [ ] Props have proper autodocs and playground toggles- [ ] Added documentation