Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intl.DateTimeFormat does not support 'und' locale #885

Open
sven-oly opened this issue Apr 30, 2024 · 7 comments
Open

Intl.DateTimeFormat does not support 'und' locale #885

sven-oly opened this issue Apr 30, 2024 · 7 comments
Labels
c: meta Component: intl-wide issues Data Related to locale data s: discuss Status: TG2 must discuss to move forward

Comments

@sven-oly
Copy link

This seems wrong. Apparently 'und' falls back to 'en', which is different behavior than ICU4C.

Examples:

Welcome to Node.js v18.19.1.
Type ".help" for more information.
> dt = new Intl.DateTimeFormat('und', {"month":"short","weekday":"narrow","day":"numeric","calendar":"gregory","numberingSystem":"latn"})
DateTimeFormat [Intl.DateTimeFormat] {}
> dt.format()
'T, Apr 30'

> Intl.DateTimeFormat.supportedLocalesOf(["und"])
[]
> Intl.DateTimeFormat.supportedLocalesOf(["und", "en"])
[ 'en' ]
 
@sffc sffc added s: discuss Status: TG2 must discuss to move forward c: meta Component: intl-wide issues Data Related to locale data labels Apr 30, 2024
@sffc
Copy link
Contributor

sffc commented Apr 30, 2024

I thought that "und" was supported in engines, but I guess not?

CC @anba @FrankYFTang @gibson042 @eemeli

@sffc sffc modified the milestone: ES 2024 Apr 30, 2024
@sffc sffc added this to Priority Issues in ECMA-402 Meeting Topics Apr 30, 2024
@eemeli
Copy link
Member

eemeli commented May 1, 2024

und is not supported in browsers. Supporting it would probably fix some of the use cases of the Stable Formatting proposal, but not all.

@FrankYFTang
Copy link
Contributor

FrankYFTang commented May 1, 2024

The reason is very simple. there are no locale resources defined for "und".
See
https://github.com/unicode-org/cldr/blob/main/common/main/und.xml
is a 404

Also ref https://tc39.es/ecma402/#available-locales-list

@sffc
Copy link
Contributor

sffc commented May 1, 2024

The resources for "und" are stored in root.xml in CLDR.

@FrankYFTang
Copy link
Contributor

FrankYFTang commented May 1, 2024

In v8, internally we call

uloc_openAvailableByType(ULOC_AVAILABLE_WITH_LEGACY_ALIASES, &status);

to find out what locales are available. neither "und" nor "root" is enumerated

https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/uloc_8h.html#a1d61e1cb6a0d2ad60dc3cd78c931e551
said
"Gets a list of available locales according to the type argument, allowing the user to access different sets of supported locales in ICU."

if "und" and "root" are not reported by ICU as "available locales", then v8 will not treat them as supported.

@FrankYFTang
Copy link
Contributor

sorry, I hit closed by accident.

@sffc
Copy link
Contributor

sffc commented May 1, 2024

I made an upstream issue: https://unicode-org.atlassian.net/browse/ICU-22766

Whether or not ICU decides to start including the root locale in the return value of uloc_openAvailableByType, I think Web engines could decide to include that locale in their own lists of supported locales.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: meta Component: intl-wide issues Data Related to locale data s: discuss Status: TG2 must discuss to move forward
Projects
Development

No branches or pull requests

4 participants