Closed Bug 1970161 Opened 6 months ago Closed 5 months ago

Implement Intl.Locale.prototype.variants

Categories

(Core :: JavaScript: Internationalization API, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
141 Branch
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.

Blocks: js-lang
Severity: -- → N/A
Priority: -- → P3

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.

This style matches the other files in js/src/builtin/intl.

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.

variant subtags are always the trailing subtags in the base-name, so if any
subtags are present after:

  1. The region subtag, if present.
  2. Or the script subtag, if present.
  3. Or otherwise the language subtag.

Then these subtags are a sequence of variant subtags.

Pushed by andre.bargull@gmail.com: https://github.com/mozilla-firefox/firefox/commit/4f1a144c78e0 https://hg.mozilla.org/integration/autoland/rev/c4d92d25d1c3 Part 1: Add setter for variant subtags to intl::Locale. r=platform-i18n-reviewers,dminor https://github.com/mozilla-firefox/firefox/commit/7db68264c767 https://hg.mozilla.org/integration/autoland/rev/20884f79db08 Part 2: Use standard approach for namespaced function definitions. r=spidermonkey-reviewers,dminor https://github.com/mozilla-firefox/firefox/commit/e3e45d6b86f2 https://hg.mozilla.org/integration/autoland/rev/771d897d8490 Part 3: Support "variants" option in Intl.Locale constructor. r=spidermonkey-reviewers,dminor https://github.com/mozilla-firefox/firefox/commit/563a00be45d6 https://hg.mozilla.org/integration/autoland/rev/a4b607578325 Part 4: Implement Intl.Locale.prototype.variants accessor. r=spidermonkey-reviewers,dminor
QA Whiteboard: [qa-triage-done-c142/b141]
Keywords: dev-doc-needed

MDN docs changes for this can be tracked in the following GitHub issue: https://github.com/mdn/content/issues/40467

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: