www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit c245cbc8673a050c023e49b497bf4f4e43072461
parent 816349948605ab1c5caec9751f63e553d22df8a4
Author: Simon Kornblith <simon@simonster.com>
Date:   Tue, 28 Feb 2012 14:56:08 -0500

Sort translators properly

Diffstat:
Mchrome/content/zotero/tools/testTranslators/translatorTester.js | 11+++--------
1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/chrome/content/zotero/tools/testTranslators/translatorTester.js b/chrome/content/zotero/tools/testTranslators/translatorTester.js @@ -72,17 +72,12 @@ Zotero_TranslatorTesters = new function() { var testersRunning = 0; var results = []; - var strcmp; - try { - var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"] - .getService(Components.interfaces.nsILocaleService); - var collationFactory = Components.classes["@mozilla.org/intl/collation-factory;1"] - .getService(Components.interfaces.nsICollationFactory); + if("getLocaleCollation" in Zotero) { var collation = collationFactory.CreateCollation(localeService.getApplicationLocale()); strcmp = function(a, b) { return collation.compareString(1, a, b); }; - } catch (e) { + } else { strcmp = function (a, b) { return a.localeCompare(b); }; @@ -102,7 +97,7 @@ Zotero_TranslatorTesters = new function() { runNextTester(); } else if(testersRunning === 0) { // Testing is done, so sort results - results.sort(function(a, b) { + results = results.sort(function(a, b) { if(a.type !== b.type) { return TEST_TYPES.indexOf(a.type) - TEST_TYPES.indexOf(b.type); }