diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common-util/sort.js | 10 | ||||
-rw-r--r-- | src/data/things/sorting-rule.js | 2 |
2 files changed, 9 insertions, 3 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 diff --git a/src/data/things/sorting-rule.js b/src/data/things/sorting-rule.js index 0ed7fb0f..b169a541 100644 --- a/src/data/things/sorting-rule.js +++ b/src/data/things/sorting-rule.js @@ -264,7 +264,7 @@ export class DocumentSortingRule extends ThingSortingRule { rules = rules .slice() - .sort((a, b) => a.filename.localeCompare(b.filename)); + .sort((a, b) => a.filename.localeCompare(b.filename, 'en')); for (const {chunk, filename} of chunkByProperties(rules, ['filename'])) { const initialLayout = getThingLayoutForFilename(filename, wikiData); |