Natural sorting of numbers ("1" < "2" < "10")

This needs testing to see if it has any other unwanted effects.

Closes Trac ticket 1031
This commit is contained in:
Dan Stillman 2014-07-08 09:47:03 -04:00
parent 87a0df43d8
commit 813f55d024

View File

@ -1488,7 +1488,10 @@ Components.utils.import("resource://gre/modules/Services.jsm");
var locale = appLocale.getCategory('NSILOCALE_COLLATE'); var locale = appLocale.getCategory('NSILOCALE_COLLATE');
// Extract a valid language tag // Extract a valid language tag
locale = locale.match(/^[a-z]{2}(\-[A-Z]{2})?/)[0]; locale = locale.match(/^[a-z]{2}(\-[A-Z]{2})?/)[0];
var collator = new Intl.Collator(locale, { ignorePunctuation: true }); var collator = new Intl.Collator(locale, {
ignorePunctuation: true,
numeric: true
});
} }
catch (e) { catch (e) {
Zotero.debug(e, 1); Zotero.debug(e, 1);