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

Add Intl.Locale test for language getter where language subtag is "und" #4393

Closed
lionel-rowe opened this issue Feb 12, 2025 · 4 comments · Fixed by #4394
Closed

Add Intl.Locale test for language getter where language subtag is "und" #4393

lionel-rowe opened this issue Feb 12, 2025 · 4 comments · Fixed by #4394

Comments

@lionel-rowe
Copy link
Contributor

Currently, both Chromium (bug) and Safari (bug) fail the following:

assert(new Intl.Locale('und').language === 'und')
assert(new Intl.Locale('und-US-u-co-emoji').language === 'und')

Firefox has the correct behavior.

Could be useful to have a test for this specific case.

@ptomato
Copy link
Contributor

ptomato commented Feb 12, 2025

I'm not sure if Firefox's is the correct behaviour. I'm looking at Canonical Unicode Locale Identifiers and I don't understand all of the terms there, but I do note that it has a special case to exclude und from one of the steps. Maybe someone with more expertise (like @gibson042 or @sffc) would be able to say what the correct behaviour is.

However, it does seem to me that Chrome and Safari's behaviour is incorrect. The loc.[[Locale]] slot being undefined fails several assertions in the spec, so it should not be possible to return undefined from this property getter.

@anba
Copy link
Contributor

anba commented Feb 13, 2025

but I do note that it has a special case to exclude und from one of the steps.

That's probably happening for "Unicode CLDR locale identifier", but ECMA-402 uses "Unicode BCP 47 locale identifiers".

@gibson042
Copy link
Contributor

I'm not sure if Firefox's is the correct behaviour. I'm looking at Canonical Unicode Locale Identifiers and I don't understand all of the terms there, but I do note that it has a special case to exclude und from one of the steps. Maybe someone with more expertise (like @gibson042 or @sffc) would be able to say what the correct behaviour is.

However, it does seem to me that Chrome and Safari's behaviour is incorrect. The loc.[[Locale]] slot being undefined fails several assertions in the spec, so it should not be possible to return undefined from this property getter.

The [[Locale]] slot of a Locale instance must always be a Unicode canonicalized locale identifier string, which for input "und" is "und" and for input "und-US-u-co-emoji" is "und-US-u-co-emoji" (i.e., both are already in canonical form). The baseName, language, script, and region getters extract and return relevant substrings. In short, the asserts in this report must pass in any conforming implementation of ECMA-402.

@ptomato
Copy link
Contributor

ptomato commented Feb 13, 2025

OK, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants