Skip to content

Add locale-aware string collation with multi-level sort keys#316

Merged
JE-Chen merged 1 commit into
devfrom
feat/locale-collation-batch
Jun 22, 2026
Merged

Add locale-aware string collation with multi-level sort keys#316
JE-Chen merged 1 commit into
devfrom
feat/locale-collation-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 22, 2026

Copy link
Copy Markdown
Member

Summary

Python's default sorted is codepoint order, so "Z" < "a" and "ä" lands far from "a". This adds locale-aware collation: a Unicode-Collation-lite sort key with three levels — primary (base letter), secondary (diacritics), tertiary (case) — plus an optional alphabet tailoring (Swedish sorts å ä ö after z). Deterministic across platforms, unlike locale.strxfrm.

Layers

  • Headless core: je_auto_control/utils/locale_collation/locale_collation.pycollation_key, compare, sort_strings. Pure stdlib (unicodedata), no PySide6, pure functions.
  • Facade: collation_key / sort_strings re-exported, compare exported as collation_compare + __all__.
  • Executor: AC_collation_sort{sorted}, AC_collation_compare{order}.
  • MCP: ac_collation_sort / ac_collation_compare.
  • Script Builder: two CommandSpecs under Data.

Tests / docs

  • test/unit_test/headless/test_locale_collation_batch.py — 9 headless tests (default/accent/case levels, Swedish tailoring, sort-by-key/reverse, key validation + wiring + facade).
  • EN/Zh feature docs v108_features_doc.rst + toctrees; 3 README What's-new sections.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 44 complexity · 0 duplication

Metric Results
Complexity 44
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit d6a079d into dev Jun 22, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/locale-collation-batch branch June 22, 2026 03:09
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant