feat(Intl): add initial Intl.DisplayNames implementation#5249
Open
Lokesh0224 wants to merge 4 commits intoboa-dev:mainfrom
Open
feat(Intl): add initial Intl.DisplayNames implementation#5249Lokesh0224 wants to merge 4 commits intoboa-dev:mainfrom
Lokesh0224 wants to merge 4 commits intoboa-dev:mainfrom
Conversation
Test262 conformance changes
Fixed tests (1):Tested main commit: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5249 +/- ##
===========================================
+ Coverage 47.24% 59.70% +12.46%
===========================================
Files 476 591 +115
Lines 46892 63486 +16594
===========================================
+ Hits 22154 37905 +15751
- Misses 24738 25581 +843 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds an initial implementation of
Intl.DisplayNames, as part of the work tracked in #3710.What's implemented
Constructor
NewTargetper ECMA-402 §12.1.1 (step 1)OrdinaryCreateFromConstructor(step 2)supportedLocalesOf
Options infrastructure
DisplayNamesTypeenum covering all six types:language,region,script,currency,calendar,dateTimeFieldOptionTypeimplementations:Style→narrow|short|longFallback→code|noneLanguageDisplay→dialect|standardicu_experimentaland may change as icu4x#3913 evolvesTests
DisplayNamesTypeparsing casesNot yet implemented
of()— §12.3.3CanonicalCodeForDisplayNames, §12.5.1)resolvedOptions()— §12.3.2Internal slot storage
[[Locale]],[[Style]],[[Type]],[[Fallback]],[[LanguageDisplay]],[[Fields]]Notes
LocaleDisplayNamesV1is used as a temporary stand-in forService::LangMarkerto supportsupportedLocalesOflocale availability checks.Intl.DisplayNamessupports multiple categories (language,region,script,currency,calendar,dateTimeField), each backed by different ICU providers. Once formatting is implemented, dispatch will occur at runtime inof()based on thetypeoption.ZeroTrie-backed multi-attribute loading) is targeted for icu4x 2.3. TheService::LangMarkerchoice will need revisiting once that design stabilizes.find_longest_matching_subtagbehavior, and multi-attribute data loading.Style,Fallback, andLanguageDisplayinoptions.rsare fromicu_experimentaland subject to change as the upstream API stabilizes. TheLanguageDisplaygroundwork already aligns with the "support dialect option" item in icu4x#3913.