Closes #1852: Test success may depend on capitalizeTitles preference
This commit is contained in:
parent
763d46a565
commit
fb87bded88
2 changed files with 20 additions and 1 deletions
chrome/content/zotero
|
@ -230,6 +230,7 @@ Zotero_TranslatorTester.prototype.runTest = function(test, doc, testDoneCallback
|
||||||
|
|
||||||
callback(newItems);
|
callback(newItems);
|
||||||
});
|
});
|
||||||
|
translate.capitalizeTitles = false;
|
||||||
|
|
||||||
// internal hack to call detect on this translator
|
// internal hack to call detect on this translator
|
||||||
translate._potentialTranslators = [this._translator];
|
translate._potentialTranslators = [this._translator];
|
||||||
|
|
|
@ -498,7 +498,7 @@ Zotero.Utilities = {
|
||||||
|
|
||||||
string = this.trimInternal(string);
|
string = this.trimInternal(string);
|
||||||
string = string.replace(/ : /g, ": ");
|
string = string.replace(/ : /g, ": ");
|
||||||
if(!Zotero.Prefs.get('capitalizeTitles') && !force) return string;
|
if(force === false || (!Zotero.Prefs.get('capitalizeTitles') && !force)) return string;
|
||||||
if(!string) return "";
|
if(!string) return "";
|
||||||
|
|
||||||
// split words
|
// split words
|
||||||
|
@ -783,6 +783,24 @@ Zotero.Utilities.Translate.prototype.strToISO = Zotero.Date.strToISO;
|
||||||
Zotero.Utilities.Translate.prototype.createContextObject = Zotero.OpenURL.createContextObject;
|
Zotero.Utilities.Translate.prototype.createContextObject = Zotero.OpenURL.createContextObject;
|
||||||
Zotero.Utilities.Translate.prototype.parseContextObject = Zotero.OpenURL.parseContextObject;
|
Zotero.Utilities.Translate.prototype.parseContextObject = Zotero.OpenURL.parseContextObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hack to overloads {@link Zotero.Utilities.capitalizeTitle} to allow overriding capitalizeTitles
|
||||||
|
* pref on a per-translate instance basis (for translator testing only)
|
||||||
|
*/
|
||||||
|
Zotero.Utilities.Translate.prototype.capitalizeTitle = function(string, force) {
|
||||||
|
if(force === undefined) {
|
||||||
|
var translate = this._translate;
|
||||||
|
do {
|
||||||
|
if(translate.capitalizeTitles !== undefined) {
|
||||||
|
force = translate.capitalizeTitles;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while(translate = translate._parentTranslator);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Zotero.Utilities.capitalizeTitle(string, force);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current Zotero version
|
* Gets the current Zotero version
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue