Don't break getLocaleCollation() in Firefox <54 (after a73b2403b)

This commit is contained in:
Dan Stillman 2017-05-27 05:37:47 -04:00
parent d6c36ae9a3
commit aa05920117

View file

@ -1330,17 +1330,18 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
}
if (Services.locale.getAppLocale) {
var appLocale = Services.locale.getAppLocale();
var locale = Services.locale.getAppLocale();
}
// Fx <=53
else {
var appLocale = Services.locale.getApplicationLocale();
var locale = Services.locale.getApplicationLocale();
locale = locale.getCategory('NSILOCALE_COLLATE');
}
try {
// Extract a valid language tag
appLocale = appLocale.match(/^[a-z]{2}(\-[A-Z]{2})?/)[0];
var collator = new Intl.Collator(appLocale, {
locale = locale.match(/^[a-z]{2}(\-[A-Z]{2})?/)[0];
var collator = new Intl.Collator(locale, {
ignorePunctuation: true,
numeric: true,
sensitivity: 'base'