wordpress-mobile / WordPress-Android

WordPress for Android
http://android.wordpress.org
GNU General Public License v2.0
2.99k stars 1.32k forks source link

Use Arabic numerals consistently #17002

Open thehenrybyrd opened 2 years ago

thehenrybyrd commented 2 years ago

Expected behavior

Arabic numerals (1 2 3 4 5 6 7 8 9 0) should be used everywhere all the time.

Actual behavior

When Arabic is the selected app language, in a number of places, but not consistently, we use Indo-Arabic numerals instead of normal Arabic numerals. We would do better to consistently use Arabic numerals (the regular ones we’re used to) rather than Eastern Arabic (Indo-Arabic) numerals – (٠ ١ ٢ ٣ ٤ ٥ ٦ ٧ ٨ ٩) – because everyone who reads Arabic knows the Arabic numerals, but not all know the Indo-Arabic numerals.

This looks especially strange on screens where we use both types of numerals:

Steps to reproduce the behavior

  1. Head to Me > App Settings > Interface Language and select Arabic.
  2. Explore the app and find the Eastern Arabic numerals displayed in various places. I've seen them in the Stats Card and Screens, Blogging Prompts Card, while selecting Media, and in Reader (dates)
Tested on Samsung Galaxy S21, Android 12, WPAndroid 20.4-rc-2
Internal reference: p5T066-3jv-p2#comment-12698
ovitrif commented 2 years ago

I've investigated the issue and for me the behaviour is a bit different.

All numbers on the stats screen are displayed in Indo-Arabic for me:

From this StackOverflow answer I understood that there was an issue filed for the Android code. Unfortunately the link to the issue doesn't work for me, saying I'm denied access (tried with 1 e-mail addresses), so I couldn't check what's going on behind the scenes and what is the latest status update on it.

While continuing to investigate the issue I've discovered another strange thing, related to the time formatting for the "best hour".

When changing the app language to Arabic and looking at the stats → insights tab, the hour is displayed and formatted with Indo-Arabic digits, as seen in the screenshot above.

If I close the app and open it again (thus the initial locale on app start is Arabic), the hour is formatted with Western Arabic numbers, and the AM/PM is shown in English:

I've started working on a fix for the original issue, but I won't be addressing this newly discovered problem in that fix, since it proves to be a different issue, which probably has its root cause in the localization system we're using. There's currently progress on updating that.

ovitrif commented 2 years ago

This PR fixes the issue for Stats: https://github.com/wordpress-mobile/WordPress-Android/pull/17160

We can apply the same approach introduced in that PR to all other places where we're displaying numerals on the UI, the solution in that PR is easily applicable in most cases; it should be fairly simple to reuse it.

The task of finding all such places is quite complex though :)

thehenrybyrd commented 2 years ago

@ovitrif thanks so much for working on this!

I won't be addressing this newly discovered problem in that fix, since it proves to be a different issue, which probably has its root cause in the localization system we're using.

Yeah, that seems quite likely. I think our primary concern should be to make sure everything looks as it should using the device language settings.

The task of finding all such places is quite complex though :)

Fair point! We could do a physical device audit to look for these numerals on all screens. I wonder though, is there a class or type based strategy we could use to find all such places in the codebase?

ovitrif commented 2 years ago

Yeah, that seems quite likely. I think our primary concern should be to make sure everything looks as it should using the device language settings.

I agree, thank you @thehenrybyrd 🙇 !

I wonder though, is there a class or type based strategy we could use to find all such places in the codebase?

That would be great indeed but it might not work in this case according to my current knowledge of the issue. We could in principle replace all usages of text views and their derivatives (MaterialTextView, WPTextView) but that might be an even bigger chunk of work that feels a bit dangerous considering the amount of testing we should be doing to make sure new bugs don't slip through.

We could do a physical device audit to look for these numerals on all screens.

In all fairness my current understanding tells me this might be the best approach to fix the issue in all places. There's definitely a big amount of work required for this, but with this approach we're sure to limit the changes to what's needed 👍

thehenrybyrd commented 2 years ago

@ovitrif that makes sense to me! This isn't high enough priority for an audit currently, but I'll keep reporting other instances when I run across them. Thanks for fixing this for stats!

ovitrif commented 2 years ago

Upon beta-testing the fixes for the in-app Stats, we've found another place where Eastern Arabic numerals should be replaced with Western Arabic ones:

thehenrybyrd commented 2 years ago

Another place we're using Eastern Arabic numerals is in the Blogging Prompts card (and in the FAB), where we state how many people have replied to a prompt, with "# answers".