Last active
October 31, 2019 07:13
-
-
Save siddharthvp/0fb11dc0a326473d2758244b15783247 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Declare fallbacks | |
Date.monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; | |
Date.monthNamesAbbrev = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; | |
$.ajax({ | |
url: mw.util.wikiScript('api'), | |
data: $.param({ action: 'query', format: 'json', utf8: 'y', meta: 'allmessages', | |
ammessages: 'january|february|march|april|may|june|july|august|september|october|november|december' + | |
'|jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec', | |
amlang: mw.config.get('wgContentLanguage') | |
}), | |
dataType: 'json', | |
headers: { | |
'Cache-Control': 'max-age=99999999, immutable' | |
} | |
}).done(function(json) { | |
if (!json || !json.query || !json.query.allmessages) return; | |
var names = json.query.allmessages.map(function(e) { return e['*']; }); | |
Date.monthNames = names.slice(0, 12); | |
Date.monthNamesAbbrev = names.slice(12); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment