Skip to content

The default locale should not contain a Unicode extension sequence - #5125

Open
jessealama wants to merge 1 commit into
tc39:mainfrom
jessealama:default-locale-no-unicode-extension
Open

The default locale should not contain a Unicode extension sequence#5125
jessealama wants to merge 1 commit into
tc39:mainfrom
jessealama:default-locale-no-unicode-extension

Conversation

@jessealama

Copy link
Copy Markdown
Contributor

DefaultLocale() isn't supposed to contain a Unicode locale extension sequence. ResolveLocale substitutes it with an empty extension when no requested locale matches, so the resolved locale of an Intl object, constructed without a locale argument, should never contain "-u-".

It looks like we don't currently test this. The new test checks it for every Intl service constructor.

This is the requirement underlying #615. The tests there append "-u-" to the default locale, which is OK, but only if the default locale doesn't already have one. Under the C locale, JSC reports "en-US-u-va-posix" as its default, and this test makes that failure visible.

Spec: https://tc39.es/ecma402/#sec-defaultlocale

@jessealama
jessealama requested a review from a team as a code owner September 2, 2026 15:17
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

1 new or modified test were run on 7 engines.

View workflow run

Test Engine262 GraalJS JavaScriptCore QuickJS SpiderMonkey V8 XS
intl402/default-locale-has-no-unicode-extension.js

@gibson042 gibson042 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd rather see this covered by an extended [and possibly renamed] test/intl402/default-locale-is-canonicalized.js.

@gibson042

Copy link
Copy Markdown
Member

I've also opened an issue to explore allowing the currently nonconforming behavior: tc39/ecma402#1098

@ptomato ptomato left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notwithstanding Richard's proposed reorganization which I don't feel strongly about either way, the test contents LGTM.

@jessealama
jessealama force-pushed the default-locale-no-unicode-extension branch from 8bdee29 to 5f7ee4a Compare September 6, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants