build: Update eslint-config-wikimedia to 0.10.0
[lhc/web/wiklou.git] / resources / src / mediawiki.jqueryMsg / mediawiki.jqueryMsg.js
index 4044f95..fdc988b 100644 (file)
@@ -1,4 +1,3 @@
-/* eslint-disable no-restricted-properties */
 /*!
 * Experimental advanced wikitext parser-emitter.
 * See: https://www.mediawiki.org/wiki/Extension:UploadWizard/MessageParser for docs
                 * @return {jQuery}
                 */
                parse: function ( key, replacements ) {
-                       var ast = this.getAst( key );
+                       var ast = this.getAst( key, replacements );
                        return this.emitter.emit( ast, replacements );
                },
 
                 * Note that we pass '⧼' + key + '⧽' back for a missing message here.
                 *
                 * @param {string} key
+                * @param {Array} replacements Variable replacements for $1, $2... $n
                 * @return {string|Array} string of '⧼key⧽' if message missing, simple string if possible, array of arrays if needs parsing
                 */
-               getAst: function ( key ) {
+               getAst: function ( key, replacements ) {
                        var wikiText;
 
                        if ( !Object.prototype.hasOwnProperty.call( this.astCache, key ) ) {
-                               wikiText = this.settings.messages.get( key );
-                               if ( typeof wikiText !== 'string' ) {
-                                       wikiText = '⧼' + key + '⧽';
+                               if ( mw.config.get( 'wgUserLanguage' ) === 'qqx' ) {
+                                       wikiText = '(' + key + '$*)';
+                               } else {
+                                       wikiText = this.settings.messages.get( key );
+                                       if ( typeof wikiText !== 'string' ) {
+                                               wikiText = '⧼' + key + '⧽';
+                                       }
                                }
+                               wikiText = mw.internalDoTransformFormatForQqx( wikiText, replacements );
                                this.astCache[ key ] = this.wikiTextToAst( wikiText );
                        }
                        return this.astCache[ key ];
                 * @param {Array} nodes List of nodes
                 * @return {string} Other message
                 */
-               'int': function ( nodes ) {
+               int: function ( nodes ) {
                        var msg = textify( nodes[ 0 ] );
                        return mw.jqueryMsg.getMessageFunction()( msg.charAt( 0 ).toLowerCase() + msg.slice( 1 ) );
                },