-
Notifications
You must be signed in to change notification settings - Fork 432
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
feat(i18n): localize global search filters and results #5108
Merged
Conversation
This file contains 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
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
Full Reportsanity
@sanity/types
sanity/desk
@sanity/diff
@sanity/block-tools
@sanity/portable-text-editor
@sanity/mutator
@sanity/cli
@sanity/schema/_internal
@sanity/util/paths
sanity/router
@sanity/util/legacyDateFormat
@sanity/schema
sanity/cli
@sanity/vision
@sanity/util/fs
sanity/_internal
@sanity/util/content
|
Component Testing Report Updated Nov 3, 2023 6:15 PM (UTC)
|
They are not supported by node 18.
rexxars
force-pushed
the
feat/sdx-599-filters
branch
from
November 3, 2023 18:09
4775dd2
to
61de8dd
Compare
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.
Description
This localizes all the different search filters, as well as the results list and orderings.
In doing so, I had the need to format both units and date/time, so I introduced two new hooks:
useIntlDateTimeFormat
- the same as the otheruseIntl*
hooks, it uses the memoized cache of formatters and returns a date/time formatter based on the current locale.useUnitFormatter
- basically the same as the otheruseIntl*
hooks, but I found it very tedious to have to calluseNumberFormat
three times if I wanted to format days, months and years - so I decided to make one that simply does this behind the scenes. It's all memoized anyway.You'll notice that the naming on the latter hook does not include the
Intl
part, and lives incore
, noti18n
. I am starting to lean in the direction that none of these hooks should include theIntl
part, as localizing should be the default for the studio, not an opt-in kind of thing. Would be interested in hearing opinions here.@robinpyon I may have butchered the beautiful work you've put into the search filters as I tried to ensure that the labels could be localized. Blown away by the amount of work you've put into the search feature ❤️
Lastly, the "debug triangles" were affecting the layout a bit to much in some cases, so I introduced a new debug mode that uses a right to left modifier symbol - it basically inverts all the text. This mode means there are little to no layout changes compared to normal, and it is still fairly easy to see what is localized and not (either they are dynamic strings, or they are yet to be localized).
Known issues/limitations
next
, so will not address it in this PR.@sanity/ui
have built-in aria labels that I was not able to localize. Have raised this as a concern and will address it separately.What to review