Provides a jQuery
plugin that parses messages.
Properties
$.fn.msgstatic
#
Parses the message in the message key, doing replacements optionally, and appends the nodes to the current selector. Bindings to passed-in jquery elements are preserved. Functions become click handlers for [$1 linktext] links.
To use this jQuery
plugin, load the mediawiki.jqueryMsg
module with mw.loader
.
Example
mw.loader.using('mediawiki.jqueryMsg' ).then(() => {
var $userlink = $( '<a>' ).click( function () { alert( "hello!!" ) } );
$( 'p#headline' ).msg( 'hello-user', $userlink );
} );
// N.B. replacements are variadic arguments or an array in second parameter. In other words:
somefunction( a, b, c, d )
// is equivalent to
somefunction( a, [b, c, d] )
// Note: We append to 'this', which in a jQuery plugin context will be the selected elements.
Parses the message in the message key, doing replacements optionally, and appends the nodes to the current selector.