Page MenuHomePhabricator

Appearence of the eastern arabic numerals on Arabic wikimedia projects
Closed, ResolvedPublic

Description

Hello, Today on Arabic Projects, the eastern arabic numerals (١, ٢, ٣ ...) Appeared, for example in this page.

I think it has something to do with MediaWiki update, so we wish to return the Arabic numbers (1, 2, 3) Thank you.

The current version of mediawiki software is: 1.36.0-wmf.16 (60e0a59)

Changes happened on 20:28 UTC, 9 November 2020, and a lot of arwiki users complained about it.

Event Timeline

Restricted Application added subscribers: alaa, Aklapper. · View Herald TranscriptNov 9 2020, 9:37 PM
Omar_Ghrida updated the task description. (Show Details)Nov 9 2020, 9:42 PM
Omar_Ghrida updated the task description. (Show Details)Nov 9 2020, 9:46 PM
Reedy renamed this task from Apparence the eastern arabic numerals on Arabic wikimedia projects to Apparence of the eastern arabic numerals on Arabic wikimedia projects.Nov 9 2020, 9:47 PM
Reedy updated the task description. (Show Details)
alaa updated the task description. (Show Details)Nov 9 2020, 9:54 PM
alaa edited subscribers, added: Urbanecm; removed: Urbanecm_WMF.
Reedy renamed this task from Apparence of the eastern arabic numerals on Arabic wikimedia projects to Appearence of the eastern arabic numerals on Arabic wikimedia projects.Nov 9 2020, 10:26 PM
Jar added a subscriber: Jar.Nov 9 2020, 10:27 PM

Quick notes for developers:

  • The default numbering system for Arabic is the Eastern Arabic numerals (١, ٢, ٣ ...)
  • However, a few years ago, Arabic Wikimedia communities decided to override this and use the Western Arabic numerals instead (1, 2, 3)
  • This is done by setting wgTranslateNumerals to false in InitialiseSettings.php
# wgTranslateNumerals @{
'wgTranslateNumerals' => [
	'default' => true,
	'arwiki' => false,
	'arwikibooks' => false, // T5442 -ævar
	'arwikiquote' => false,
	'arwiktionary' => false, // T35758
	'arwikisource' => false,
	'arwikiversity' => false,
	'arwikinews' => false,
FShbib added a subscriber: FShbib.Nov 9 2020, 11:18 PM

Looking into it. ::formatNum *should* honor $wgTranslateNumerals, but not impossible something regressed here.

PHP's NumberFormatter is translating the digits even before we get to the part of the mediawiki code which is *supposed* to translate digits:

>>> $fmt = new NumberFormatter('ar', NumberFormatter::PATTERN_DECIMAL, "#,##0.###");

=> NumberFormatter {#2557
     locale: "",
     pattern: "#,##0.###",
      …3
   }
>>> $fmt->format(1234)
=> "١٬٢٣٤"

So we'll have to explicitly turn that off when $wgTranslateNumerals is false. Patch in a moment.

Change 640477 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/core@master] language: Honor $wgTranslateNumerals, even if PHP does digit translation

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

Change 640487 had a related patch set uploaded (by Brennen Bearnes; owner: C. Scott Ananian):
[mediawiki/core@wmf/1.36.0-wmf.16] language: Honor $wgTranslateNumerals, even if PHP does digit translation

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

Change 640477 merged by jenkins-bot:
[mediawiki/core@master] language: Honor $wgTranslateNumerals, even if PHP does digit translation

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

Change 640487 merged by jenkins-bot:
[mediawiki/core@wmf/1.36.0-wmf.16] language: Honor $wgTranslateNumerals, even if PHP does digit translation

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

alaa awarded a token.Nov 10 2020, 8:01 PM

Mentioned in SAL (#wikimedia-operations) [2020-11-10T20:27:25Z] <brennen@deploy1001> Started scap: Backport: [[gerrit:640487|language: Honor $wgTranslateNumerals, even if PHP does digit translation(T267614)]] and [[gerrit:640488|Downgrade the severity of the non-numeric argument to formatNum warnings (T267370, T267587)]]

Mentioned in SAL (#wikimedia-operations) [2020-11-10T21:02:06Z] <brennen@deploy1001> Finished scap: Backport: [[gerrit:640487|language: Honor $wgTranslateNumerals, even if PHP does digit translation(T267614)]] and [[gerrit:640488|Downgrade the severity of the non-numeric argument to formatNum warnings (T267370, T267587)]] (duration: 34m 46s)

brennen closed this task as Resolved.Nov 10 2020, 9:09 PM
brennen claimed this task.
brennen added a subscriber: brennen.

Fix tested and deployed, appears to be working. Please re-open if we missed anything.

Followup task in T268632