Skip to content

feat(helper): support locale-aware category sorting - #5819

Open
stevenjoezhang wants to merge 1 commit into
masterfrom
agent/support-category-locale
Open

feat(helper): support locale-aware category sorting#5819
stevenjoezhang wants to merge 1 commit into
masterfrom
agent/support-category-locale

Conversation

@stevenjoezhang

Copy link
Copy Markdown
Member

What does it do?

Adds an optional locale option to list_categories so category names can be sorted with Intl.Collator.

Locale-aware sorting is only used when orderby is name and a locale is explicitly provided. Existing sites that do not set locale continue to use Warehouse's current sorting behavior.

For example:

<%- list_categories({ locale: 'zh-CN' }) %>

The tests cover the existing Unicode order, Chinese locale-aware order, and descending order.

Closes #5631.

Screenshots

N/A — this changes category ordering generated by a helper.

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.

@github-actions

Copy link
Copy Markdown

How to test

git clone -b agent/support-category-locale https://github.com/hexojs/hexo.git
cd hexo
npm install
npm test

@stevenjoezhang
stevenjoezhang marked this pull request as ready for review August 12, 2026 18:40
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.

Can the sorting of category names currently support Chinese?

2 participants