Page MenuHomePhabricator

Support Eastern Arabic numerals in project portals
Open, Needs TriagePublic

Description

Per m:Requests_for_comment/numerals_in_Wikipedia_main_portal, it is requested that the project portals use Eastern Arabic numerals in situations where the language context is Persian, eg "۷۴۵٬۳۰۳ مقاله" instead of "745,303 مقاله". (Preferably unmangled by ltr :) )

(It might be also worthwhile to use number.toLocaleString() in general on the portal, so that all languages have localized numbers appropriately formatted, including, eg, appropriate comma placement for certain Indian languages, etc.)

Event Timeline

Hello
I want to work on this issue.
I made a researched about the issue what this issue exactly demands
Can you give me some insights so i can proceed further to solve this issue.
And i also want to know that how can i convert the language of wikipedia portal from english to persian language.
Because at main page https://www.wikipedia.org/ i can only see the option to read articles in persian not to convert the language of the page
and a search box where i can search any article in persian

I hope i am clear :)

@Bharatkhatri351: Hi, thanks for your interest. Could you please clarify which specific further insights you need? Thanks.

And i also want to know that how can i convert the language of wikipedia portal from english to persian language.

That sound like a separate topic how to use that portal, unrelated to the scope of this task ("Support Eastern Arabic numerals"). Please see the link I posted. ^

But indeed this seems broken (thanks for catching this), so I filed T275597: Portal ignores Accept-Language header, content always in English language.

hello @Jdrewniak
I am working on this isssue can you help me out please i am stuck at a point
i have change my browser prefered language and this result as shown

image.png (768×1 px, 131 KB)

but i am not able to see language changes in my localhost its still shows in english
image.png (768×1 px, 117 KB)

so how can i observe changes
if i do some change in persian language.
or changes in function to observe it on persian lang.

Hey , Where exactly do we not have Eastern Arabic Numerals?
Are we talking about count of articles being displayed on portals like this

Screenshot from 2021-03-09 09-06-47.png (921×1 px, 158 KB)

Because fa.wikipedia.org correctly translates all the numerals to Eastern Arabic.
Correct me if I am wrong but currently only main portal has the JavaScript based translation mechanism, then

Number.toLocaleString()

can only be used for the main portal. If that's the case then we can apply the same method to other portals too once we have single build system for all the pages.

Because fa.wikipedia.org correctly translates all the numerals to Eastern Arabic.
Correct me if I am wrong but currently only main portal has the JavaScript based translation mechanism, then

this is the issue on main portal https://www.wikipedia.org/ not on fa.wikipedia.org
Actually the wikipedia portal takes your browser default language to show you portal main page
their is no button to change wikipedia portal language.
You have to change your browser language to "persian" to observe this issue.

image.png (768×1 px, 131 KB)

you can see issue in this image

their is no button to change wikipedia portal language.
You have to change your browser language to "persian" to observe this issue.

I don't think that's the issue we're talking about. As far as I know, we have to display Eastern Arabic numerals along with Persian text.
But I am not sure if we're just talking about the numerals used for displaying articles count because those are the only numerals which are not converted to the local string.

But I am not sure if we're just talking about the numerals used for displaying articles count because those are the only numerals which are not converted to the local string.

yes, here we are talking about numerals used for displaying articles count. As per my research.

their is no button to change wikipedia portal language.
You have to change your browser language to "persian" to observe this issue.

in this comment i am only telling you a way to observe isssue......

in this comment i am only telling you a way to observe isssue......

Yeah I had already observed this that way but thanks :)

After hours of going through the codebase this is what I know :

  • It will be quite easy to convert the articles count to their local string using Number.toLocaleString() but this will convert every articles count irrespective of language. e.g. If a person's preferred browser language is Persian then he/she will be able to see the Eastern Arabic numerals but this will also convert counts of other languages too. I don't think it'd be good idea to have numerals of one language with text of some other language.
  • To have both numerals and text in the same language, we'd require complete locale code. e.g. hi-IN, fa-IR etc. which then would be used as an argument for toLocaleString() function. This is not available as of now, we just have hi, fa etc.

How exactly do we want them to be displayed? @Jdrewniak @Aklapper

After hours of going through the codebase this is what I know :

  • It will be quite easy to convert the articles count to their local string using Number.toLocaleString() but this will convert every articles count irrespective of language. e.g. If a person's preferred browser language is Persian then he/she will be able to see the Eastern Arabic numerals but this will also convert counts of other languages too. I don't think it'd be good idea to have numerals of one language with text of some other language.
  • To have both numerals and text in the same language, we'd require complete locale code. e.g. hi-IN, fa-IR etc. which then would be used as an argument for toLocaleString() function. This is not available as of now, we just have hi, fa etc.

How exactly do we want them to be displayed? @Jdrewniak @Aklapper

i have a doubt if you do any kind of changes regarding language.
Are you able to see in your local host.
Because in my case
local host is only showing page in english language inspite of selected language is persian.

i have a doubt if you do any kind of changes regarding language.
Are you able to see in your local host.
Because in my case
local host is only showing page in english language inspite of selected language is persian.

Mine is working fine when I change my browser's preferred language but gulp is not really changing the DOM immediately, I have to run npm run start again to see changes. This might be an issue with gulp.

@Bharatkhatri351 check the network tab in the devtools console. The page should request a file similar to fa.json that contains the Persian translations. Is it giving a 404?
(this may be an issue with symlinks, there is portal symlink in wikipedia.org/portal that may have to be changed to work on windows, I'll add that to T274886).

@Tsiruot number.toLocaleString() doesn't necessarily require the full language code, the partial one also works:
new Number(12345.6).toLocaleString('fa'); //returns "۱۲٬۳۴۵٫۶" .

Ideally however, I think this should be done on the server. According to the MDN documentation for number.toLocaleString, Node 13 supports the different locales. The MediaWiki CI pipeline currently runs Node 10, so getting this to work there may be challenging, but I'd prefer to investigate that option before trying to do this in the browser.

@Jdrewniak Yeah this totally makes sense afterall we don't want any type of ambiguity.

I just went through the past discussion
@Bharatkhatri351 I understood what you said but not completely can you once again elaborate the observation perspective?

I just went through the past discussion
@Bharatkhatri351 I understood what you said but not completely can you once again elaborate the observation perspective?

Convert your browser language to persian (from settings of your browser).Then Open wikipedia portal main page then you can observe this issue..
i have mentioned some screenshots of issue above....

I'd like to work on this. @Bharatkhatri351 you mind if I give it a shot?

I'd like to work on this. @Bharatkhatri351 you mind if I give it a shot?

Yaa sure if you are intersted we can both work on it. This task need a deep investigation in working of locale in node 10 and node 13 before any further changes. We can discuss for further in Zulip chat. I can share my progress there :-)

Thanks for you interest