Page MenuHomePhabricator

Mentor dashboard in bnwiki: registration date numbers are Arabic numerals instead of Bengali numerals
Open, MediumPublic

Description

In bnwiki, the date of registration displayed on the ''Mentor dashboard'' is Arabic numerals, instead of Bengali ones.

0, 1, 2, 3, 4, 5, 6, 7, 8, 9 should be ০, ১, ২, ৩, ৪, ৫, ৬, ৭, ৮, ৯, respectively (Ref: Bengali numerals article).

image.png (597×873 px, 50 KB)

Similar cases happened before, so I think these can be relevant: T274379 and T284046.

Event Timeline

Restricted Application added subscribers: alaa, Aklapper. · View Herald Transcript

@Amire80, I'd like to have your opinion on this. Is there a way to avoid this recurring issue of Bengali numerals being replaced by Arabic ones?

Actually, @Nikerabbit probably knows this part of the code much better than I do. I guess that some discipline is needed about about using functions for digit conversion when outputting numbers, but I'm rusty about the details.

I know nothing of the Growth Experiments code, but I think the cause is that in https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/GrowthExperiments/+/refs/heads/master/includes/Rest/Handler/MenteesHandler.php#115 the date is not formatted using our date formatting methods, and on the front-end JavaScript code just outputs that value verbatim.

kostajh triaged this task as Medium priority.Oct 13 2021, 7:20 AM

I know nothing of the Growth Experiments code, but I think the cause is that in https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/GrowthExperiments/+/refs/heads/master/includes/Rest/Handler/MenteesHandler.php#115 the date is not formatted using our date formatting methods, and on the front-end JavaScript code just outputs that value verbatim.

Hmm, what's the correct way to display a date in Y-m-d format, if not MWTimestamp::getInstance( $menteeData['registration'] )->format( 'Y-m-d' )? Or should I not do that, and instead always use $context>getLanguage()->userDate($timestamp, $mentor)? I'm worried that it could make that comment go very wide.

I would encourage the usage of Language::userDate. There doesn't seem to be a way to request a short format, so using Language::sprintfDate with 'Y-m-d' format may be acceptable workaround, but users may not be familiar with this date format.

Change 735770 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@master] MenteesHandler: Output date using correct numerals

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

I decided to use Language::sprintfDate for now, and discuss the possibility of using Language::userDate in another task: T292658: Match user preferences when displaying dates in mentor dashboard.

Change 735770 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] MenteesHandler: Output date using correct numerals

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