Alphabetical order varies by language
Aliases: locale-aware sorting · localized sorting · collation tailoring
What it is
Locale-sensitive collation compares strings according to a reader's language and a particular sorting convention, rather than by Unicode code point, UTF-8 byte sequence, or the English alphabet. The Unicode Collation Algorithm (UCA) supplies a complete baseline order, while the Common Locale Data Repository (CLDR) expresses language- and usage-specific differences through collation tailorings. The same names may appear in different positions in Swedish, German, and English interfaces, and a language can offer standard, phonebook, or other orders. Alphabetical order is therefore not an intrinsic property of text; it is a view produced from data, locale, collation type, and comparison options.
Why it happens
A collator maps text to layered collation weights and compares primary differences before secondary and finer ones. UCA supplies the baseline, while CLDR tailorings can reposition letters, treat a sequence as a contraction, or expand one character into several collation elements to match local convention. A language-only locale may still fall back through script, region, and root data; an unavailable collation type also falls back, so setting a system locale does not prove that the requested rules were loaded. Human-facing order should use an explicit locale and collation type, while matching should use a search-oriented configuration. Database primary keys, foreign keys, and identity deduplication need immutable IDs or explicitly normalized identifiers, never a display sort key that can change with locale, library version, or tailoring.
Studying it
Build cross-locale golden sets containing local letters, combining sequences, punctuation, numbers, mixed scripts, and realistic personal or place names, then have speakers familiar with the convention review expected adjacency. Implementation tests should capture the requested locale, resolved locale, collation type, library, and CLDR/UCA version before exercising pairwise comparisons, complete list sorts, and upgrade diffs. In a finding task, compare code-point order, an incorrect locale, and the intended tailoring; measure location time, wrong selections, and fallback to search. Report compliance with library output separately from fit with the target community's lookup habits—an English-only fixture cannot validate another language's order.
Where it stops holding
A locale does not always select one uncontested order. A language may have regional variants, phonebook conventions, or rules imposed by a regulated or professional directory. User-generated collections can also contain unknown languages and mixed scripts, requiring a declared product policy plus a search fallback for entries with no intuitive position. Unicode, CLDR, and runtime upgrades can change results even though they continue to define a complete order. Reproducible pagination, auditing, or distributed processing therefore requires a pinned implementation and data version plus a unique stable final tie-breaker. A locale sort key is not a durable cross-version identity.
Applying it
- Pass the content locale, collation type, and comparison options explicitly for every visible list. Capture the resolved configuration and monitor unsupported-tailoring fallback instead of inheriting a server default silently.
- Generate display order with a locale-aware collator and finish equal comparisons with a stable record ID. Include the collation configuration version in cursor contracts, invalidating or migrating cursors when it changes.
- Build search with a separate search collator, transliteration layer, or retrieval index, deciding deliberately which differences are ignorable. Do not use display order for exact identity, authorization, or uniqueness constraints.
- Review upgrade snapshots with realistic target-language data, covering boundaries, adjacency, mixed scripts, numbers, nulls, and newly assigned characters; then verify findability with list-navigation tasks.
Related
- Same group: S2.08.2 Chinese can be sorted by pinyin, stroke count, or radical · S2.08.3 Case and diacritics affect collation results · S2.08.4 Index navigation must switch with language
- Adjacent: S1.02.1 Mirroring applies to layout and direction, not every graphic · S2.01.4 The first day of the week varies by region
- Search terms:
Unicode Collation Algorithm·CLDR collation tailoring·locale-sensitive sorting