diff --git a/chrome/content/zotero/xpcom/cite.js b/chrome/content/zotero/xpcom/cite.js index a10c4c965..388c2dbc4 100644 --- a/chrome/content/zotero/xpcom/cite.js +++ b/chrome/content/zotero/xpcom/cite.js @@ -1161,8 +1161,13 @@ Zotero.CSL.Global = new function() { this.getLocatorStrings = getLocatorStrings; this.cleanXML = cleanXML; this.parseLocales = parseLocales; - + this.ns = "http://purl.org/net/xbiblio/csl"; + + this.locale = this.__defineGetter__("locale", function() { + Zotero.CSL.Global.init() + return Zotero.CSL.Global._xmlLang; + }); this.collation = Components.classes["@mozilla.org/intl/collation-factory;1"] .getService(Components.interfaces.nsICollationFactory) .CreateCollation(Components.classes["@mozilla.org/intl/nslocaleservice;1"] diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 77350ae61..f5a21c5d6 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -1329,14 +1329,20 @@ Zotero.Date = new function(){ // MONTH if(!date.month) { // compile month regular expression - var months = Zotero.CSL.Global.getMonthStrings("short"); + var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', + + 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; + // If using a non-English bibliography locale, try those too + if (Zotero.CSL.Global.locale != 'en-US') { + months = months.concat(Zotero.CSL.Global.getMonthStrings("short")); + } if(!_monthRe) { _monthRe = new RegExp("^(.*)\\b("+months.join("|")+")[^ ]*(?: (.*)$|$)", "i"); } var m = _monthRe.exec(date.part); if(m) { - date.month = months.indexOf(m[2][0].toUpperCase()+m[2].substr(1).toLowerCase()); + // Modulo 12 in case we have multiple languages + date.month = months.indexOf(m[2][0].toUpperCase()+m[2].substr(1).toLowerCase()) % 12; date.part = m[1]+m[3]; Zotero.debug("DATE: got month ("+date.month+", "+date.part+")"); }