Skip to content

feat(@formatjs/intl-locale): support variants per latest spec#5904

Closed
longlho wants to merge 1 commit into01-14-feat_formatjs_intl-getcanonicallocales_update_to_latest_spec_handle_arraylike_objsfrom
01-14-feat_formatjs_intl-locale_support_variants_per_latest_spec
Closed

feat(@formatjs/intl-locale): support variants per latest spec#5904
longlho wants to merge 1 commit into01-14-feat_formatjs_intl-getcanonicallocales_update_to_latest_spec_handle_arraylike_objsfrom
01-14-feat_formatjs_intl-locale_support_variants_per_latest_spec

Conversation

@longlho
Copy link
Copy Markdown
Member

@longlho longlho commented Jan 15, 2026

TL;DR

Added the variants property to Intl.Locale and improved documentation for CanonicalizeLocaleList.

What changed?

  • Added the variants getter to the Intl.Locale class that returns variant subtags joined with hyphens in alphabetical order
  • Added detection for the variants property in the shouldPolyfill function
  • Added comprehensive tests for the new variants property with various locale scenarios
  • Enhanced documentation in intl-getcanonicallocales with ECMA-402 spec references for better clarity

How to test?

  • Run the new test cases that verify the variants property works correctly:
    • Returns undefined for locales without variants
    • Returns the variant string for locales with a single variant
    • Returns hyphen-joined variants in alphabetical order for locales with multiple variants
    • Handles various locale formats with scripts, extensions, and numeric variants

Why make this change?

This change implements the variants property that was added to ECMA-402 via PR #960 to align with other subtag accessors. The property provides access to the variant subtags of a locale, which was previously missing from the implementation. This brings the polyfill in line with the latest ECMA-402 specification.

References:

@longlho longlho marked this pull request as ready for review January 15, 2026 02:10
Copy link
Copy Markdown
Member Author

longlho commented Jan 15, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • main - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

graphite-app Bot pushed a commit that referenced this pull request Jan 15, 2026
### TL;DR

Added the `variants` property to `Intl.Locale` and improved documentation for `CanonicalizeLocaleList`.

### What changed?

- Added the `variants` getter to the `Intl.Locale` class that returns variant subtags joined with hyphens in alphabetical order
- Added detection for the `variants` property in the `shouldPolyfill` function
- Added comprehensive tests for the new `variants` property with various locale scenarios
- Enhanced documentation in `intl-getcanonicallocales` with ECMA-402 spec references for better clarity

### How to test?

- Run the new test cases that verify the `variants` property works correctly:
  - Returns `undefined` for locales without variants
  - Returns the variant string for locales with a single variant
  - Returns hyphen-joined variants in alphabetical order for locales with multiple variants
  - Handles various locale formats with scripts, extensions, and numeric variants

### Why make this change?

This change implements the `variants` property that was added to ECMA-402 via PR #960 to align with other subtag accessors. The property provides access to the variant subtags of a locale, which was previously missing from the implementation. This brings the polyfill in line with the latest ECMA-402 specification.

References:
- https://tc39.es/ecma402/#sec-Intl.Locale.prototype.variants
- tc39/ecma402#960
- tc39/ecma402#900
@graphite-app
Copy link
Copy Markdown

graphite-app Bot commented Jan 15, 2026

Merge activity

  • Jan 15, 2:24 AM UTC: longlho added this pull request to the Graphite merge queue.
  • Jan 15, 2:24 AM UTC: CI is running for this pull request on a draft pull request (#5907) due to your merge queue CI optimization settings.
  • Jan 15, 2:40 AM UTC: Merged by the Graphite merge queue via draft PR: #5907.

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 this pull request may close these issues.

1 participant