Page MenuHomePhabricator

Change Levantine Arabic's interface to Western Arabic numerals
Closed, ResolvedPublicFeature

Description

Change the symbols used to represent numbers in the Levantine Arabic interface (language code: apc) from Easter Arabic numerals (١ ٢ ٣) to Western Arabic numerals (1 2 3).

Benefits (why should this be implemented?): Requested by the community working on the Levantine Arabic Wikipedia (me and User:HitomiAkane). Western Arabic numerals are more widespread and widely understood than Eastern Arabic numerals in the Levant nowadays.

Thank you.


For a new developer implementing this task, change is likely to be made to the $digitTransformTable variable in languages/messages/MessagesApc.php file in the mediawiki/core repository.

Event Timeline

Oh wait, Levantine Arabic Wikipedia (apc) is still in the Incubator. I am not sure if this possible

Levantine Arabic's Wikipedia doesn't have a big community. But the two most-active editors have requested the change.

User:HitomiAkane said this on https://discord.gg/5jKcDQJkcu:

قتراح:
نستخدم الأرقام العربية (1 2 3 4 5 6 7 8 9 0) بدل الهندية (۰ ۱ ۲ ۳ ٤ ٥ ٦ ٧ ۸ ۹)

Suggestion:
We use Arabic numerals (1 2 3 4 5 6 7 8 9 0) instead of Easter Arabic numerals (٠ ١ ٢ ٣ ٤ ٥ ٦ ٧ ٨ ٩). (translation mine)

And I agree. It was what I requested to begin with when the translation interface was being set up a few months ago (https://translatewiki.net/wiki/User_talk:FunLater) but this isn't what ended up happening.

Thank you for tagging this task with good first task for Wikimedia newcomers!

Newcomers often may not be aware of things that may seem obvious to seasoned contributors, so please take a moment to reflect on how this task might look to somebody who has never contributed to Wikimedia projects.

A good first task is a self-contained, non-controversial task with a clear approach. It should be well-described with pointers to help a completely new contributor, for example it should clearly pointed to the codebase URL and provide clear steps to help a contributor get setup for success. We've included some guidelines at https://phabricator.wikimedia.org/tag/good_first_task/ !

Thank you for helping us drive new contributions to our projects <3

Change #1132149 had a related patch set uploaded (by ParvC; author: ParvC):

[mediawiki/core@master] T382781 Changed Levantine Arabic numerals to Western numerals

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

Change #1132149 had a related patch set uploaded (by Amire80; author: ParvC):

[mediawiki/core@master] Changed Levantine Arabic numerals to Western numerals

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

Change #1132149 merged by jenkins-bot:

[mediawiki/core@master] Changed Levantine Arabic numerals to Western numerals

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

cscott subscribed.

This seems to have regressed in PHP 8.4.

$ vendor/bin/phpunit tests/phpunit/includes/Languages/LanguageApcTest.php 
Using PHP 8.4.13
Running with MediaWiki settings because there might be integration tests
PHPUnit 9.6.21 by Sebastian Bergmann and contributors.

FFF.............................................                  48 / 48 (100%)

Time: 00:00.148, Memory: 52.50 MB

There were 3 failures:

1) MediaWiki\Tests\Languages\LanguageApcTest::testFormatNum with data set #0 ('1234567890', '1,234,567,890')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'1,234,567,890'
+'١,٢٣٤,٥٦٧,٨٩٠'

/home/cananian/Projects/Wikimedia/core/tests/phpunit/includes/Languages/LanguageApcTest.php:16
=== Logs generated by test case
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"Wikimedia\\ObjectCache\\HashBagOStuff"}
[localisation] [debug] LocalisationCache using store LCStoreNull []
[localisation] [debug] LocalisationCache::loadCoreData: got localisation for apc from source []
===

2) MediaWiki\Tests\Languages\LanguageApcTest::testFormatNum with data set #1 (-12.89, '−12.89')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'−12.89'
+'−١٢.٨٩'

/home/cananian/Projects/Wikimedia/core/tests/phpunit/includes/Languages/LanguageApcTest.php:16
=== Logs generated by test case
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"Wikimedia\\ObjectCache\\HashBagOStuff"}
[localisation] [debug] LocalisationCache using store LCStoreNull []
[localisation] [debug] LocalisationCache::loadCoreData: got localisation for apc from source []
===

3) MediaWiki\Tests\Languages\LanguageApcTest::testFormatNum with data set #2 ('1289.456', '1,289.456')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'1,289.456'
+'١,٢٨٩.٤٥٦'

/home/cananian/Projects/Wikimedia/core/tests/phpunit/includes/Languages/LanguageApcTest.php:16
=== Logs generated by test case
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"Wikimedia\\ObjectCache\\HashBagOStuff"}
[localisation] [debug] LocalisationCache using store LCStoreNull []
[localisation] [debug] LocalisationCache::loadCoreData: got localisation for apc from source []
===

It looks like PHP is helpfully converting the number to arabic itself, which means that the digitTransformTable in MessageApc.php isn't doing anything:

$digitTransformTable = [
	'0' => '0',
	'1' => '1',
	'2' => '2',
	'3' => '3',
	'4' => '4',
	'5' => '5',
	'6' => '6',
	'7' => '7',
	'8' => '8',
	'9' => '9',
];

Change #1202377 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/core@master] [PHP 8.4] Ensure Levantine Arabic numerals stay as Western numerals

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

Looks like the tests were a good idea! And Thanks to @cscott for finding a solution that actually works.

Change #1202377 merged by jenkins-bot:

[mediawiki/core@master] [PHP 8.4] Ensure Levantine Arabic numerals stay as Western numerals

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

anything else left to do here

I believe everything is working just fine now. Thank you all.