2 * Allows to retrieve a specific or a set of
3 * messages to be added to mw.messages and returned
6 * @class mw.Api.plugin.messages
12 $.extend( mw.Api.prototype, {
14 * Get a set of messages.
16 * @param {Array} messages Messages to retrieve
17 * @return {jQuery.Promise}
19 getMessages: function ( messages ) {
24 amlang: mw.config.get( 'wgUserLanguage' ),
26 } ).then( function ( data ) {
29 $.each( data.query.allmessages, function ( i, obj ) {
31 result[ obj.name ] = obj.content;
40 * Loads a set of mesages and add them to mw.messages.
42 * @param {Array} messages Messages to retrieve
43 * @return {jQuery.Promise}
45 loadMessages: function ( messages ) {
46 return this.getMessages( messages ).then( $.proxy( mw.messages, 'set' ) );
52 * @mixins mw.Api.plugin.messages
55 }( mediaWiki, jQuery ) );