Intl version missing country locale
danilobuerger opened this issue · 10 comments
Issue Description
Locale English (Germany)
date.toLocaleString('en-DE', {year: 'numeric', month: 'numeric', day: 'numeric'})
returns
12/20/2012
but should return
20.12.2012
Locale German (United States)
date.toLocaleString('de-US', {year: 'numeric', month: 'numeric', day: 'numeric'})
returns
20.12.2012
but should return
12/20/2012
It seems like whatever country is specified in the locale it is just being ignored.
Version, config, any additional info
"jsc-android": "236355.1.1"
using intl via
implementation "org.webkit:android-jsc-intl:r236355"
Hey @danilobuerger, I've tested the code you said in Chrome and it seems Chrome's result is opposite to your expectation.
const date = new Date();
date.toLocaleString('en-DE', {year: 'numeric', month: 'numeric', day: 'numeric'})
// 15/05/2019
const date = new Date();
date.toLocaleString('de-US', {year: 'numeric', month: 'numeric', day: 'numeric'})
// 15.5.2019
Hi @Kudo, my bug report is about missing regions, not really about date formatting. Let me give you a different example that you can follow along in Chrome:
Chrome 74.0.3729.131, Safari 12.1, iOS 12.2
var x = 1.2;
console.log(x.toLocaleString('de-US'));
console.log(x.toLocaleString('en-DE'));
> "1,2"
> "1,2"
As you can see, Chrome, Safari and iOS all print out 1,2
in both regions.
Now the JSC:
var x = 1.2;
console.log(x.toLocaleString('de-US'));
console.log(x.toLocaleString('en-DE'));
> "1,2"
> "1.2"
Notice how its always 1,2
in en-DE
, except with the JSC which uses 1.2
. That would be expected for the language en
, if the region is missing:
console.log(x.toLocaleString('en'));
> "1.2"
Thanks for your clear example.
After some tracing and debugging, I found the root cause is that the ICU we used is not support en-DE locale, so it fallbacks to en.
Update ICU could include more locale data but I should still profile the binary size increase.
@Kudo Thanks for looking into it. It seems that package.json
defines a really old version to use:
"chromiumICUCommit": "b34251f8b762f8e2112a89c587855ca4297fed96"
https://chromium.googlesource.com/chromium/deps/icu/+/b34251f8b762f8e2112a89c587855ca4297fed96
Is it as easy as just bumping the commit hash there? A lot has happened in 2 years regarding ICU, so if possible it should be current.
I tried updating the commit hash to the current 64e5d7d43a1ff205e3787ab6150bbc1a1837332b
but receive the following error when building:
Item region/en.res depends on missing item region/root.res
Yes, it needs some fine tune or patch.
My first priority is focusing the JSC crash issue, will update ICU after that.
@Kudo any news on this?
@Kudo any news on this?
@danilobuerger Sorry for late.
I finally take time to figure out ICU 64 data buildtool change.
Here is the PR #121