www

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

commit f3bae4b00052a3cbf946ed2a9525e75c6e4ebb52
parent 99a2ac7967777811e8c7c7f19f36e4ca92d34edd
Author: aurimasv <aurimas.dev@gmail.com>
Date:   Fri,  6 Apr 2012 20:31:28 -0500

Allow running detect with multiple translators set.

Diffstat:
Mchrome/content/zotero/xpcom/translation/translate.js | 15+++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js @@ -898,6 +898,7 @@ Zotero.Translate.Base.prototype = { // do not allow simultaneous instances of getTranslators if(this._currentState === "detect") throw new Error("getTranslators: detection is already running"); this._currentState = "detect"; + this._getAllTranslators = getAllTranslators; if(checkSetTranslator) { // setTranslator must be called beforehand if checkSetTranslator is set @@ -905,11 +906,17 @@ Zotero.Translate.Base.prototype = { throw new Error("getTranslators: translator must be set via setTranslator before calling" + " getTranslators with the checkSetTranslator flag"); } - var translator = Zotero.Translators.get(this.translator[0]); - if(!translator) throw new Error("getTranslators: could not retrieve translator '" + this.translator[0] + "'"); - this._getTranslatorsTranslatorsReceived([translator]); + var translators = new Array(); + var t; + for(var i=0, n=this.translator.length; i<n; i++) { + t = Zotero.Translators.get(this.translator[i]); + if(!t) Zotero.debug("getTranslators: could not retrieve translator '" + this.translator[i] + "'"); + /**TODO: check that the translator is of appropriate type*/ + else translators.push(t); + } + if(!translators.length) throw new Error("getTranslators: no valid translators were set."); + this._getTranslatorsTranslatorsReceived(translators); } else { - this._getAllTranslators = getAllTranslators; this._getTranslatorsGetPotentialTranslators(); }