Always try English short month strings when parsing dates in addition to those of the bibliography locale
This commit is contained in:
parent
5bf7106d5b
commit
9a44efa8cf
|
@ -1163,6 +1163,11 @@ Zotero.CSL.Global = new function() {
|
||||||
this.parseLocales = parseLocales;
|
this.parseLocales = parseLocales;
|
||||||
|
|
||||||
this.ns = "http://purl.org/net/xbiblio/csl";
|
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"]
|
this.collation = Components.classes["@mozilla.org/intl/collation-factory;1"]
|
||||||
.getService(Components.interfaces.nsICollationFactory)
|
.getService(Components.interfaces.nsICollationFactory)
|
||||||
.CreateCollation(Components.classes["@mozilla.org/intl/nslocaleservice;1"]
|
.CreateCollation(Components.classes["@mozilla.org/intl/nslocaleservice;1"]
|
||||||
|
|
|
@ -1329,14 +1329,20 @@ Zotero.Date = new function(){
|
||||||
// MONTH
|
// MONTH
|
||||||
if(!date.month) {
|
if(!date.month) {
|
||||||
// compile month regular expression
|
// 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) {
|
if(!_monthRe) {
|
||||||
_monthRe = new RegExp("^(.*)\\b("+months.join("|")+")[^ ]*(?: (.*)$|$)", "i");
|
_monthRe = new RegExp("^(.*)\\b("+months.join("|")+")[^ ]*(?: (.*)$|$)", "i");
|
||||||
}
|
}
|
||||||
|
|
||||||
var m = _monthRe.exec(date.part);
|
var m = _monthRe.exec(date.part);
|
||||||
if(m) {
|
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];
|
date.part = m[1]+m[3];
|
||||||
Zotero.debug("DATE: got month ("+date.month+", "+date.part+")");
|
Zotero.debug("DATE: got month ("+date.month+", "+date.part+")");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user