Skip to content

Intl: Locale unicode extension properties not parsed (-u- subtags) #601

@frostney

Description

@frostney

Summary

`Intl.Locale` does not parse Unicode extension subtags (`-u-`). Properties like `calendar`, `numberingSystem`, `caseFirst`, `collation`, `hourCycle` return `undefined` even when the locale tag contains them. `baseName` incorrectly includes the extension substring.

Why

~40 intl402 test262 tests check Locale Unicode extension handling.

Current behavior

```js
const loc = new Intl.Locale("en-US-u-nu-latn-ca-gregory");
loc.calendar // undefined (should be "gregory")
loc.numberingSystem // undefined (should be "latn")
loc.baseName // "en-US-u-nu-latn-ca-gregory" (should be "en-US")
```

Expected behavior

BCP 47 `-u-` extension keywords should be parsed per UTS #35. The `BCP47.pas` parser already captures extensions as `TBcp47Extension` records with singleton `'u'`. The Locale constructor needs to extract known keywords (`ca`, `co`, `hc`, `kf`, `kn`, `nu`) from the `u` extension value and populate the corresponding properties.

Scope notes

Also need to handle the `options` constructor argument overriding tag-derived values, and the `baseName` getter stripping all extensions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    engineTGocciaEngine: language semantics, ECMAScript built-ins, parser, interpreter, bytecode VM

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions