Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
var api = new mw.Api();
var token = mw.user.tokens.values.csrfToken;
api.get({
action: 'query',
list: 'allpages',
aplimit: 'max',
apprefix: mw.config.get('wgTitle'),
apnamespace: mw.config.get('wgNamespaceNumber'),
formatversion: 2
}).done(function(data) {
$.each(data.query.allpages, function() {
var page = this;
api.post({
action: 'setpagelanguage',
title: page.title,
lang: 'es',
reason: "Page is in Spanish",
token: token,
formatversion: 2
}).done(function(data){
console.log(page.title + ' must have had content language changed');
})
})
});