Page MenuHomePhabricator

Remove stateful mw.Message#toString behaviour
Open, MediumPublic

Description

Currently:

var x = mw.message('addedwatchtext', 'X');
x.toString()
// "[[:X]]" and its talk page have been added to your [[Special:Watchlist|watchlist]].
x.text()
// "[[:X]]" and its talk page have been added to your [[Special:Watchlist|watchlist]].

x.escaped()
// "[[:X]]" and its talk page have been added to your [[Special:Watchlist|watchlist]].
x.toString()
// "[[:X]]" and its talk page have been added to your [[Special:Watchlist|watchlist]].
var x = mw.message('echo-badge-count', 42);
x.toString()
// "42"
x.text()
// "42"

x.plain()
// "{{PLURAL:42|42|100={{formatnum:99}}+}}"
x.toString()
// "{{PLURAL:42|42|100={{formatnum:99}}+}}"

We're recently finished removal of the same mess in wfMessage/Message.php:

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 726289 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/core@master] mediawiki.base: Clean up unit tests for mw.Message

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

Change 726290 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/core@master] mediawiki.base: Require `format` param in internal message parser()

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

Change 726291 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/core@master] [WIP] mediawiki.base: Deprecate stateful use of toString()

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

Change 726336 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/core@master] mediawiki.base: Add tests for mw.log.deprecate()

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

Change 726337 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/core@master] mediawiki.base: Introduce mw.log.makeDeprecated()

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

Change 727437 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/extensions/Wikibase@master] wikibase.templates: Simplify with mw.format() instead of mw.Message

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

Change 727437 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] wikibase.templates: Simplify with mw.format() instead of mw.Message

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

Krinkle triaged this task as Medium priority.Oct 8 2021, 5:42 PM
Krinkle moved this task from Inbox to Accepted Enhancement on the MediaWiki-ResourceLoader board.

Change 726336 merged by jenkins-bot:

[mediawiki/core@master] mediawiki.base: Add tests for mw.log.deprecate()

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

Change 726337 merged by jenkins-bot:

[mediawiki/core@master] mediawiki.base: Introduce mw.log.makeDeprecated()

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

Change 726290 merged by jenkins-bot:

[mediawiki/core@master] mediawiki.base: Require `format` param in internal message parser()

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

Change 726289 merged by jenkins-bot:

[mediawiki/core@master] mediawiki.base: Clean up unit tests for mw.Message

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

Change 726291 merged by jenkins-bot:

[mediawiki/core@master] mediawiki.base: Deprecate stateful use of toString()

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