From a56e800d7cf0a2c8487a425455a6f13697f97a7d Mon Sep 17 00:00:00 2001 From: Aurimas Vinckevicius Date: Fri, 14 Nov 2014 02:54:53 -0600 Subject: [PATCH] Add Zotero.localeCompare Can be used directly in Array.sort() as the sorting function. Uses LocaleCollateion.compareString internally --- chrome/content/zotero/xpcom/zotero.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 749bf3dd0..3501acb3b 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -1531,6 +1531,12 @@ Components.utils.import("resource://gre/modules/osfile.jsm"); }; } + this.defineProperty(this, "localeCompare", { + get: function() { + var collation = this.getLocaleCollation(); + return collation.compareString.bind(collation, 1); + } + }, {lazy: true}); /* * Sets font size based on prefs -- intended for use on root element