fix: sort group and category titles with localeCompare#3120
Merged
Gerrit0 merged 1 commit intoJul 3, 2026
Merged
Conversation
The equal-weight fallback in sortGroupCallback and sortCatCallback compared titles with > (UTF-16 code point order), which sorts every uppercase letter before every lowercase one and ignores locale collation. The alphabetical reflection sort already uses localeCompare (TypeStrong#2684), so custom @group and @category titles now do the same to stay consistent.
Collaborator
|
Thank you! |
This file contains hidden or 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
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.
sortGroupCallbackandsortCatCallbackorder groups/categories by a fixed weight first, then fall back to comparing the titles when two entries share the same weight. That fallback useda.title > b.title ? 1 : -1, which compares by UTF-16 code point. Code point order places every uppercase letter before every lowercase one and ignores locale collation, so a group namedcomponentssorted afterHelpersandUtilities, and accented titles sorted after every unaccented one.The
alphabeticalreflection sort already moved tolocaleComparein #2684, andsortGroupCallbackcarries a note that it should be kept in sync with the category sort. This change makes both title fallbacks uselocaleCompareso custom@group/@categorytitles order the same way reflection names do.Only equal-weight titles are affected, which in practice means user-defined
@group/@categorynames that are not listed ingroupOrder/categoryOrder; built-in kind groups keep their existing weighted order. I added a behavior test covering both sorts. Its assertion relies on case differences (componentsbeforeHelpersbeforeUtilities), which holds regardless of the host locale, and the existing converter specs are unchanged.