Intl.Collator and String.prototype.localeCompare use root collation for every locale, so languages whose alphabet reorders letters sort wrongly. JavaScriptCore and node (both ICU) agree with each other and disagree with zig-js.
Measured, same program under zig-js (Debug test262 --eval), JavaScriptCore (home-tool) and node v24.4.1:
| expression | zig-js | JSC / node |
|---|---|---|
"ä".localeCompare("z", "sv") | -1 | 1 |
"ö".localeCompare("z", "sv") | -1 | 1 |
"å".localeCompare("z", "da") | -1 | 1 |
"ch".localeCompare("h", "cs") | -1 | 1 |
new Intl.Collator("sv").compare("ä", "z") | -1 | 1 |
["z","ä","a","ö"].sort(new Intl.Collator("sv").compare) | a,ä,ö,z | a,z,ä,ö |
Swedish and Danish place å ä ö after z; Czech sorts the digraph ch after h. zig-js returns the root order in each case.
What already works
This is a tailoring gap only — the root collation and the option surface are right. All of these match node and JSC today:
- German
"ä"vs"z"(root order is correct forde), German"ß"vs"ss", Spanish"ñ"vs"o", French"cote"vs"côte" - case ordering,
{numeric: true},{sensitivity: "base"},{usage: "search"}, andresolvedOptions().locale
So the comparison pipeline and the CLDR option plumbing are in place; what is absent is the per-locale tailoring table that reorders or contracts elements on top of the root order.
Scope, for whoever picks it up
The engine already generates CLDR-derived tables through tools/gen_cldr_*.ts (locale, numbers, plurals, timedata, tzalias) and Unicode tables through gen_case/gen_norm/gen_grapheme, so the generator pattern exists. A tailoring import is a bigger data question than those: CLDR ships collation rules per locale, and even a reduced set (the ~20 locales whose tailorings reorder primary weights) is meaningfully larger than the current CLDR tables. Worth deciding how much is wanted before building it — a full ICU-equivalent import is likely out of proportion, while the reordering locales alone would close every row above.
test262 does not cover this: Intl.Collator tests assert the option surface and self-consistency, not locale-specific orderings, so the corpus stays green either way.