Skip to content

Commit

Permalink
Don't break getLocaleCollation() in Firefox <54 (after a73b240)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstillman committed May 27, 2017
1 parent d6c36ae commit aa05920
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions chrome/content/zotero/xpcom/zotero.js
Expand Up @@ -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'
Expand Down

0 comments on commit aa05920

Please sign in to comment.