diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-02-25 06:18:37 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-02-25 06:18:37 -0400 |
commit | b26e3d21191e501994bf8ed9acc4e67681ea569e (patch) | |
tree | 0d81533b0b13cacb811df9173fa698b2ff86f5f8 /src/common-util | |
parent | 96f2d47b8e46c95e546e5e0335bdfaaca58309ef (diff) |
sort: canonize sorting locale, just in case
Diffstat (limited to 'src/common-util')
-rw-r--r-- | src/common-util/sort.js | 10 |
1 files changed, 8 insertions, 2 deletions
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 |