Page MenuHomePhabricator

Implement numParams in jqueryMsg
Open, MediumPublic

Description

To match PHP side.


Version: 1.22.0
Severity: normal

Details

Reference
bz55775

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:38 AM
bzimport set Reference to bz55775.
bzimport added a subscriber: Unknown Object (MLST).
matmarex renamed this task from Implement numParams in JavaScript to Implement numParams in jqueryMsg.Dec 31 2014, 12:16 AM
matmarex set Security to None.
matmarex removed a subscriber: Unknown Object (MLST).

Is there any reason to do this besides "it will look like it is PHP"?

That and to make the correct behavior be the simple(st) way of writing code.

The coding style that's emerged for this is mw.language.convertNumber.

// plain parameters
mw.msg( key, thing );
//> "Hello $1" => "Hello Thing"

// number parameter
mw.msg( key, mw.language.convertNumber( edits ) );
//> "$1 edits" => "1,024 edits"

This separates the concerns of message formatting and value formatting, avoids extra dependencies, and I think is much easier to understand by not having to know the special method for a certain thing in addition to learning the "normal" way to do it for other scenarios.

If there was a common problem to avoid or some deeper integration that plain calls can't provide, I would agree there is added value, but in its current form, I think this is all we need?

Krinkle removed m4tx as the assignee of this task.Jul 21 2019, 1:14 AM
Krinkle added a subscriber: m4tx.
Krinkle edited projects, added Performance-Team (Radar); removed Performance-Team.
Krinkle moved this task from Limbo to Watching on the Performance-Team (Radar) board.
Krinkle moved this task from Inbox to Backlog on the MediaWiki-ResourceLoader board.