Implement Intl.Locale.prototype.variants
Categories
(Core :: JavaScript: Internationalization API, enhancement, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox141 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
References
(Blocks 1 open bug)
Details
(Keywords: dev-doc-complete)
Attachments
(4 files)
Implement the changes from https://github.com/tc39/ecma402/pull/960.
Updated•6 months ago
|
| Assignee | ||
Comment 1•6 months ago
|
||
The setter is used in part 3. Also change the internal representation for
variant subtags from heap-allocated char to stack-allocated LanguageTagSubtag.
This adds eight bytes to intl::Locale (before 144 bytes, now 153 bytes), which
seems acceptable. Using stack-allocations also avoids complications with
SpiderMonkey integration, because SM isn't allowed to use plain malloc, which
means it's not possible to directly use mozilla::UniquePtr<char[]>.
And expose IsStructurallyValidVariantTag in non-debug code for part 3.
| Assignee | ||
Comment 2•6 months ago
|
||
This style matches the other files in js/src/builtin/intl.
| Assignee | ||
Comment 3•6 months ago
|
||
Read the "variants" option, parse it as a sequence of variant subtags, and
then use mozilla::intl::Locale::SetVariants to set the new variant subtags.
Also update spec step references.
| Assignee | ||
Comment 4•6 months ago
|
||
variant subtags are always the trailing subtags in the base-name, so if any
subtags are present after:
- The
regionsubtag, if present. - Or the
scriptsubtag, if present. - Or otherwise the
languagesubtag.
Then these subtags are a sequence of variant subtags.
https://hg.mozilla.org/mozilla-central/rev/c4d92d25d1c3
https://hg.mozilla.org/mozilla-central/rev/20884f79db08
https://hg.mozilla.org/mozilla-central/rev/771d897d8490
https://hg.mozilla.org/mozilla-central/rev/a4b607578325
Updated•5 months ago
|
Comment 7•4 months ago
|
||
MDN docs changes for this can be tracked in the following GitHub issue: https://github.com/mdn/content/issues/40467
Updated•4 months ago
|
Description
•