Page MenuHomePhabricator

Numbers in the "create account benefits" in Special:CreateAccount are always parsed as English
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:

  • The numbers are parsed as English, e.g. "10,666"

What should have happened instead?:

  • The number should be parsed as the local language. For Farsi: "۱۰٬۶۶۶ "

Why it happens:

  • The numbers are taken from separate MediaWiki messages that are ignored for translation (since they will always be the same in all languages). Thus they fall back to English, and the number is parsed with English formatting because the message it comes from is technically English.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Event Timeline

Change #1192942 had a related patch set uploaded (by Jon Harald Søby; author: Jon Harald Søby):

[mediawiki/core@master] Don't use parsed messages to get numbers in Special:CreateAccount

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

This was probably caused by e7eecbd9e3f19e7a404abea620f3e0f567b1d697 / T268492.

As a workaround, I think you could just change ->text() to ->plain() here:

					$numberUnescaped = $this->msg( "createacct-benefit-head$benefitIdx" )->text();

This will make it return the wikitext of the messages (e.g. {{NUMBEROFEDITS}}) rather than the number formatted using the wrong language's rules. Later that wikitext will be parsed when it's passed as a parameter to a parsed message, which will use the correct language:

							$this->msg( "createacct-benefit-text$benefitIdx" )->params(
								$numberUnescaped,
								$numberHtml
							)->parse()

This should avoid @Tacsipacsi's concerns about changing the messages, and still fix the issue. For what it's worth, I agree that the messages are used in a weird way in this interface, but we don't have to refactor that to fix this problem.

This should avoid @Tacsipacsi's concerns about changing the messages, and still fix the issue.

But that wouldn't fix the issue I pointed out in my reply: By changing just the number message on Commons, all other languages than English now say "<number of files> pages".