'use strict'; const slice = Array.prototype.slice; // Apply site-level data mw.config.set( require( './config.json' ) ); require( './log.js' ); /** * @class mw.Message * @classdesc Describes a translateable text or HTML string. Similar to the Message class in MediaWiki PHP. * * @example * var obj, str; * mw.messages.set( { * 'hello': 'Hello world', * 'hello-user': 'Hello, $1!', * 'welcome-user': 'Welcome back to $2, $1! Last visit by $1: $3', * 'so-unusual': 'You will find: $1' * } ); * * obj = mw.message( 'hello' ); * mw.log( obj.text() ); * // Hello world * * obj = mw.message( 'hello-user', 'John Doe' ); * mw.log( obj.text() ); * // Hello, John Doe! * * obj = mw.message( 'welcome-user', 'John Doe', 'Wikipedia', '2 hours ago' ); * mw.log( obj.text() ); * // Welcome back to Wikipedia, John Doe! Last visit by John Doe: 2 hours ago * * // Using mw.msg shortcut, always in "text' format. * str = mw.msg( 'hello-user', 'John Doe' ); * mw.log( str ); * // Hello, John Doe! * * // Different formats * obj = mw.message( 'so-unusual', 'Time "after"