Spanishi - Panama and Arabic - Moroco : number format from Intl API is wrong
Reported by
felipes...@gmail.com,
Jun 13 2017
|
|||||
Issue description
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
Steps to reproduce the problem:
1. Try format a number using Intl.NumberFormat('es-PA').format(10000)
What is the expected behavior?
Should return 10,000
What went wrong?
It returning 10.000 (this is like most spanish speaking countries number format is, but Panama use 10,000)
Did this work before? N/A
Does this work in other browsers? N/A
Chrome version: 58.0.3029.110 Channel: n/a
OS Version: OS X 10.12.4
Flash Version:
This works fine on Safari, Firefox and Node. It also works like this on Opera.
,
Jun 13 2017
Unfortunately, Chrome doesn't support the es-PA locale, and instead falls back to es. You can see this with the simple query,
Intl.NumberFormat('es-PA').resolvedOptions().locale
In Chrome, I get "es", whereas in SpiderMonkey and JSC, I get "es-PA". Spec-wise, user agents have it in their power to choose which locales they want to support, but it's clearly a suboptimal user experience here.
I'm not sure what led to this decision to leave out es-PA; it may have to do with small download sizes for mobile. Jungshik, do you have any more context?
,
Jun 15 2017
,
Jun 15 2017
Is Adam the right person for this bug? It could be the Chrome Internationalization Team, who owns the infrastructure for setting up the locale data (which is entirely outside of V8), e.g., jshin@chromium.org. I didn't assign previously, as Jungshik is already cc'd (by virtue of the component).
,
Jun 15 2017
,
Jun 16 2017
es-PA should fall back to es-419, but v8's locale fallback currently does not support side-way fallback, I'm afraid. Anyway, the root cause of this issue is that es-PA locale data is not included in Chrome's copy of ICU. > I'm not sure what led to this decision to leave out es-PA; it may have to do with small download sizes for mobile. Jungshik, do you have any more context? Not just mobile but also desktop. Most of es-foo are not included. The size difference wouldn't be huge for es-* (neither are many of other language variants like ar-*, fr-*, de-*, en-*). I'll look into adding at least es-PA and perhaps other es-*.
,
Jun 19 2017
FWIW there have been a number of other bugs opened about the lack of en variants, e.g., https://bugs.chromium.org/p/chromium/issues/detail?id=94906 , so this seems like a great idea to me.
,
Jun 20 2017
bug 94906 (pls, don't use the full url; it does not show the tooltip; see monorail bug:1133 ) is not directly related to this. Anyway, en-AU is supported even now.
,
Jun 20 2017
oops. see monorail bug 1133 :-)
,
Jun 20 2017
bug monorail:1133 (sorry for bug spam)
,
Jul 17 2017
Hmm.... actually, es-PA number format should work without es-PA locale data if v8 Intl implementation does the right locale fallback from es-PA to es-419. es-419 and es-PA have the same number format. It's broken because es-PA falls back to es (or es-ES) when es-PA data is missing.
,
Jul 18 2017
10178576 => 10191200 : data size increase for adding es-variants is < 13kB. (I dropped a few es-variants). Will add them as well and see how big the difference is.
,
Jul 18 2017
Intl.NumberFormat('ar-DZ').format(10000.567)
expected: "10.000,567"
ar-DZ uses 'Latin' number elements, but the current output falls back to the default Arabic number elements in ar locale. There are a few other Arabic locales with this issue.
Intl.NumberFormat('ar-MA').format(10000.567); Moroco is another. It uses Latin number elements with '.' as a thousand separator and ',' as a decimal place symbol.
expected: "10.000,567"
I'm adding Arabic variants with NumberElements different from "ar" while adding 'es' variants.
,
Jul 18 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/deps/icu.git/+/1fec0c83e9ad7f5a075ae0b50af9a3889f54be0e commit 1fec0c83e9ad7f5a075ae0b50af9a3889f54be0e Author: Jungshik Shin <jshin@chromium.org> Date: Tue Jul 18 18:43:48 2017 Add es, en and ar variants The following locale variants are added to the ICU. Only source/data/locales are added and other locale categories are left alone. - es-* variants - en-SG and en-HK - Arabic variants whose NumberElements are different from ar. Data file size changes: - desktop: 10192200 - 10178576 = 13624 (adding es variants) 10197040 - 10192200 = 4840 (adding ar variants) - Android: 6635632 - 6616864 = 18768 - iOS: 6623888 - 6605152 = 18736 Bug: chromium:732762 Test:See the bug report and comment 13 TBR=littledan@chromium.org Change-Id: I3e87be3413e22aa49f24f81b0e25bd6e4187c0d4 Reviewed-on: https://chromium-review.googlesource.com/576113 Reviewed-by: Jungshik Shin <jshin@chromium.org> [modify] https://crrev.com/1fec0c83e9ad7f5a075ae0b50af9a3889f54be0e/android/icudtl.dat [modify] https://crrev.com/1fec0c83e9ad7f5a075ae0b50af9a3889f54be0e/common/icudtb.dat [modify] https://crrev.com/1fec0c83e9ad7f5a075ae0b50af9a3889f54be0e/common/icudtl.dat [modify] https://crrev.com/1fec0c83e9ad7f5a075ae0b50af9a3889f54be0e/ios/icudtl.dat [modify] https://crrev.com/1fec0c83e9ad7f5a075ae0b50af9a3889f54be0e/source/data/locales/reslocal.mk
,
Jul 18 2017
,
Jul 18 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/01f386bfb5e4de91a53f06fdae37d62415ee874e commit 01f386bfb5e4de91a53f06fdae37d62415ee874e Author: Jungshik Shin <jshin@chromium.org> Date: Tue Jul 18 23:17:09 2017 Roll ICU to 1fec0c8 and add 4 languages to A-L list. This will increase the ICU data size by ~21 kB (desktop) and ~18 kB (Android and iOS). 1fec0c8: Add Spanish, Arabic and English variants for better locale coverage in v8's Intl API support. 01ab158: Add the display names of 4 languages for Translate UI. http://chromium.googlesource.com/chromium/deps/icu.git/+log/b971435..1fec0c8 BUG= chromium:733398 , chromium:732762 TEST=See the bug TBR=littledan@chromium.org,yyushkina@chromium.org Change-Id: Ib45942a069511b359495e73ad611b99d381a1e8f Reviewed-on: https://chromium-review.googlesource.com/576383 Commit-Queue: Jungshik Shin <jshin@chromium.org> Reviewed-by: Jungshik Shin <jshin@chromium.org> Cr-Commit-Position: refs/heads/master@{#487657} [modify] https://crrev.com/01f386bfb5e4de91a53f06fdae37d62415ee874e/DEPS [modify] https://crrev.com/01f386bfb5e4de91a53f06fdae37d62415ee874e/chrome/browser/chromeos/locale_change_guard_unittest.cc [modify] https://crrev.com/01f386bfb5e4de91a53f06fdae37d62415ee874e/ui/base/l10n/l10n_util.cc
,
Jul 19 2017
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by sdy@chromium.org
, Jun 13 2017Labels: -OS-Mac