Page MenuHomePhabricator

jqueryMsg can not parse wikilink with parameters in page name
Closed, ResolvedPublic

Description

jqueryMsg can not handle a message with source:

[[Special:GettingStarted/task/$1|Try another article ►]]

and a string parameter (e.g. 'copyedit').

This works fine on the server. It renders to:

<a href="/wiki/Special:GettingStarted/task/copyedit" title="Special:GettingStarted/task/copyedit">Try another article ►</a>

I suspect that support for replacements in such places needs to be broadened in general. Right now, EXTLINKPARAM is a related special case.

See Also: T45510: jqueryMsg can not handle external links/wikilinks with dollar signs in the URL/target

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 1:18 AM
bzimport set Reference to bz47395.
bzimport added a subscriber: Unknown Object (MLST).
  • Bug 51388 has been marked as a duplicate of this bug. ***
  • Bug 53346 has been marked as a duplicate of this bug. ***

Confirmed. I tested the following code on Google Chrome console

mw.loader.using( 'mediawiki.jqueryMsg', function(){

mw.messages.set( {
  bug47395a: '[[$1|Text]]',
  bug47395b: '[[link|$1]]'
} );
alert(
  mw.message( 'bug47395a', 'ABC' ).plain() + ': ' +
  mw.message( 'bug47395a', 'ABC' ).parse() + '\n' +
  mw.message( 'bug47395b', 'ABC' ).plain() + ': ' +
  mw.message( 'bug47395b', 'ABC' ).parse()
);

} );

and got the following message on Portuguese Wikipedia:

[[ABC|Text]]: bug47395a: Parse error at position 0 in input: [[$1|Text]]
[[link|ABC]]: <a title="link" href="/wiki/link">ABC</a>

  • Bug 58961 has been marked as a duplicate of this bug. ***

For anyone interested, you can workaround this until this is fixed:

mw.loader.using( 'mediawiki.jqueryMsg', function () {

mw.messages.set( {
    foo: '[[$1]]'
} );

var msg = mw.message( 'foo', 'bar' ).plain();
// [[bar]]

mw.messages.set( {
    'some-random-message': msg
} );

msg = mw.message( 'some-random-message' ).parse();
// <a title="bar" href="/wiki/bar">bar</a>

console.log( msg );

} );

matmarex renamed this task from jqueryMsg can not parse wikilink with dollar sign in page name to jqueryMsg can not parse wikilink with parameters in page name.Oct 5 2015, 12:19 PM

Change 243637 had a related patch set uploaded (by Bartosz Dziewoński):
Refactor handling of replacements/parameters in links

https://gerrit.wikimedia.org/r/243637

Change 243637 merged by jenkins-bot:
mediawiki.jqueryMsg: Refactor handling of replacements/parameters in links

https://gerrit.wikimedia.org/r/243637

This bug is referenced by code in mediawiki.feedback/feedback.js. One assumes that can be fixed now?