Board Thread:Support Requests - Getting Technical/@comment-3279487-20161005125325/@comment-2200849-20161005134914

that function returns a promise - put your callback in a callback: /** @return instance of jQuery.Promise */ function loadMessages( messages ) { return new mw.Api.get( {		action: 'query',		meta: 'allmessages',		ammessages: messages.join( '|' ),		amlang: mw.config.get( 'wgUserLanguage' )	} ).then( function ( data ) {		$.each( data.query.allmessages, function ( i, message ) { if ( message.missing !== '' ) { mw.messages.set( message.name, message['*'] ); }		} );	} ); } loadMessages( [ 'edit' ] ).then(function { // now it's loaded alert( mw.message('edit').text ); });