Skip to content

fix: sort group and category titles with localeCompare#3120

Merged
Gerrit0 merged 1 commit into
TypeStrong:masterfrom
greymoth-jp:fix-locale-sort-group-category-titles
Jul 3, 2026
Merged

fix: sort group and category titles with localeCompare#3120
Gerrit0 merged 1 commit into
TypeStrong:masterfrom
greymoth-jp:fix-locale-sort-group-category-titles

Conversation

@greymoth-jp

Copy link
Copy Markdown
Contributor

sortGroupCallback and sortCatCallback order groups/categories by a fixed weight first, then fall back to comparing the titles when two entries share the same weight. That fallback used a.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 named components sorted after Helpers and Utilities, and accented titles sorted after every unaccented one.

The alphabetical reflection sort already moved to localeCompare in #2684, and sortGroupCallback carries a note that it should be kept in sync with the category sort. This change makes both title fallbacks use localeCompare so custom @group / @category titles order the same way reflection names do.

Only equal-weight titles are affected, which in practice means user-defined @group / @category names that are not listed in groupOrder / categoryOrder; built-in kind groups keep their existing weighted order. I added a behavior test covering both sorts. Its assertion relies on case differences (components before Helpers before Utilities), which holds regardless of the host locale, and the existing converter specs are unchanged.

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.
@Gerrit0

Gerrit0 commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

@Gerrit0 Gerrit0 added this to the v0.28.20 milestone Jul 3, 2026
@Gerrit0 Gerrit0 merged commit 72f20cd into TypeStrong:master Jul 3, 2026
1 of 8 checks passed
@TypeStrong TypeStrong deleted a comment from Dayday10 Jul 4, 2026
@TypeStrong TypeStrong deleted a comment from Dayday10 Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants