mw.jqueryMsg: Match behavior when key does not exist to PHP
authorBartosz Dziewoński <matma.rex@gmail.com>
Tue, 15 Nov 2016 17:55:48 +0000 (18:55 +0100)
committerBartosz Dziewoński <matma.rex@gmail.com>
Tue, 15 Nov 2016 18:30:25 +0000 (18:30 +0000)
Follow-up to e681e5d8c974914f957e24fd29de5caf160152fb. This only
affects the output of '{{int:}}' in jqueryMsg-parsed messages.

See 184658eb32f6c5561cd3789716bd98c1e9f0ba04.

Change-Id: I90390e014b897084692fb1a86a5a8bcefd93ff11

resources/src/mediawiki/mediawiki.jqueryMsg.js
tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js

index 2646cff..cad59b8 100644 (file)
 
                /**
                 * Fetch the message string associated with a key, return parsed structure. Memoized.
-                * Note that we pass '[' + key + ']' back for a missing message here.
+                * Note that we pass '⧼' + key + '⧽' back for a missing message here.
                 *
                 * @param {string} key
-                * @return {string|Array} string of '[key]' if message missing, simple string if possible, array of arrays if needs parsing
+                * @return {string|Array} string of '⧼key⧽' if message missing, simple string if possible, array of arrays if needs parsing
                 */
                getAst: function ( key ) {
                        var wikiText;
                        if ( !this.astCache.hasOwnProperty( key ) ) {
                                wikiText = this.settings.messages.get( key );
                                if ( typeof wikiText !== 'string' ) {
-                                       wikiText = '\\[' + key + '\\]';
+                                       wikiText = '⧼' + key + '⧽';
                                }
                                this.astCache[ key ] = this.wikiTextToAst( wikiText );
                        }
index caaef83..1218137 100644 (file)
 
                assert.equal(
                        formatParse( 'uses-missing-int' ),
-                       '[doesnt-exist]',
+                       '⧼doesnt-exist⧽',
                        'int: where nested message does not exist'
                );
        } );