Fix getLocaleCollation() in Firefox 54

This commit is contained in:
Dan Stillman 2017-05-27 05:29:34 -04:00
parent 19b4a7c458
commit ceb4c5eb61

View file

@ -1498,15 +1498,15 @@ Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
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 {
var locale = appLocale.getCategory('NSILOCALE_COLLATE');
// Extract a valid language tag
locale = locale.match(/^[a-z]{2}(\-[A-Z]{2})?/)[0];
var collator = new Intl.Collator(locale, {
@ -1516,7 +1516,7 @@ Components.utils.import("resource://gre/modules/Services.jsm");
});
}
catch (e) {
Zotero.debug(e, 1);
Zotero.logError(e);
// If there's an error, just skip sorting
collator = {