From b26e3d21191e501994bf8ed9acc4e67681ea569e Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 25 Feb 2025 06:18:37 -0400 Subject: sort: canonize sorting locale, just in case --- src/common-util/sort.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/common-util') diff --git a/src/common-util/sort.js b/src/common-util/sort.js index ea1e024a..fd382033 100644 --- a/src/common-util/sort.js +++ b/src/common-util/sort.js @@ -3,6 +3,12 @@ // initial sort matters! (Spoilers: If what you're doing involves any kind of // parallelization, it definitely matters.) +// TODO: This is obviously limiting. It does describe the behavior +// we've been *assuming* for the entire time the wiki is around, +// but it would be nice to support sorting in different locales +// somehow. +export const SORTING_LOCALE = 'en'; + import {empty, sortMultipleArrays, unique} from './sugar.js'; @@ -17,8 +23,8 @@ export function compareCaseLessSensitive(a, b) { const bl = b.toLowerCase(); return al === bl - ? a.localeCompare(b, undefined, {numeric: true}) - : al.localeCompare(bl, undefined, {numeric: true}); + ? a.localeCompare(b, SORTING_LOCALE, {numeric: true}) + : al.localeCompare(bl, SORTING_LOCALE, {numeric: true}); } // Subtract common prefixes and other characters which some people don't like -- cgit 1.3.0-6-gf8a5