From 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Mon, 12 Aug 2013 09:28:15 +0200 Subject: Update to MediaWiki 1.21.1 --- resources/jquery/jquery.localize.js | 59 ++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 27 deletions(-) (limited to 'resources/jquery/jquery.localize.js') diff --git a/resources/jquery/jquery.localize.js b/resources/jquery/jquery.localize.js index 3e786ec2..d9a2b199 100644 --- a/resources/jquery/jquery.localize.js +++ b/resources/jquery/jquery.localize.js @@ -1,9 +1,31 @@ /** - * Simple Placeholder-based Localization + * @class jQuery.plugin.localize + */ +( function ( $, mw ) { + +/** + * Gets a localized message, using parameters from options if present. + * @ignore + * + * @param {Object} options + * @param {string} key + * @returns {string} Localized message + */ +function msg( options, key ) { + var args = options.params[key] || []; + // Format: mw.msg( key [, p1, p2, ...] ) + args.unshift( options.prefix + ( options.keys[key] || key ) ); + return mw.msg.apply( mw, args ); +} + +/** + * Localizes a DOM selection by replacing elements with localized text and adding + * localized title and alt attributes to elements with title-msg and alt-msg attributes + * respectively. * - * Call on a selection of HTML which contains elements or elements + * Call on a selection of HTML which contains `` elements or elements * with title-msg="message-key", alt-msg="message-key" or placeholder-msg="message-key" attributes. - * elements will be replaced with localized text, *-msg attributes will be replaced + * `` elements will be replaced with localized text, *-msg attributes will be replaced * with attributes that do not have the "-msg" suffix and contain a localized message. * * Example: @@ -77,34 +99,12 @@ * Appends something like this to the body... *

You may not get there all in one piece.

* - */ -( function ( $, mw ) { - -/** - * Gets a localized message, using parameters from options if present. - * - * @function - * @param {String} key Message key to get localized message for - * @returns {String} Localized message - */ -function msg( options, key ) { - var args = options.params[key] || []; - // Format: mw.msg( key [, p1, p2, ...] ) - args.unshift( options.prefix + ( options.keys[key] || key ) ); - return mw.msg.apply( mw, args ); -} - -/** - * Localizes a DOM selection by replacing elements with localized text and adding - * localized title and alt attributes to elements with title-msg and alt-msg attributes - * respectively. - * * @method * @param {Object} options Map of options to be used while localizing - * @param {String} options.prefix String to prepend to all message keys + * @param {string} options.prefix String to prepend to all message keys * @param {Object} options.keys Message key aliases, used for remapping keys to a template * @param {Object} options.params Lists of parameters to use with certain message keys - * @returns {jQuery} This selection + * @return {jQuery} */ $.fn.localize = function ( options ) { var $target = this, @@ -162,4 +162,9 @@ $.fn.localize = function ( options ) { // Let IE know about the msg tag before it's used... document.createElement( 'msg' ); +/** + * @class jQuery + * @mixins jQuery.plugin.localize + */ + }( jQuery, mediaWiki ) ); -- cgit v1.2.3-54-g00ecf