Intl LocaleMatcher ?
- Stage: Unstaged
- Status: Active
- ECMAScript edition: —
- Synchronized: Nov 3, 2026
- 中文译文 · Source repository
The proposal adds Intl.LocaleMatcher to prepare available translation locales once and match user preferences. The constructor snapshots and canonicalizes available locales, reads options once, and exposes a match method that returns a canonical available tag or undefined. Matching can use RFC 4647 prefix lookup or the default best fit behavior based on ECMA-402's implementation-defined matching, without requiring CLDR/ICU data or scores.
The README below comes from the upstream repository and may contain outdated stage or status metadata. Use the proposal details above as the current source of truth.
Intl.LocaleMatcher
Prepare available translation locales once, then match user preferences.
Stage 1. Champion: Long Ho.
Specification · Source · Research and open issues · FormatJS ponyfill
Proposed API
- Constructor snapshots and canonicalizes available locales; later mutations
don't affect it. Options are read once and require an object or
undefined. lookupuses RFC 4647 prefix lookup.best fit(default) reuses ECMA-402's implementation-defined matching, without requiring CLDR/ICU data or scores.matchreturns one canonical available tag orundefined. No implicit default or requested Unicodeuextensions are added to the result.- Inputs follow
CanonicalizeLocaleList: strings, Intl.Locale objects, and array-like lists. Generic iterables are not consumed. Availableuextensions remain rejected; private-use tone matching remains unspecified.
Draft API change: instance method replaces static Intl.LocaleMatcher.match.
The FormatJS ponyfill currently implements the older stateless API.
HTTP parsing, message fallback, multiple results, and resource indices stay outside this draft. Open decisions and foundational precedents are in design notes.
Build
Strict ecmarkup build checks syntax, references, and algorithm lint rules. Runtime conformance tests are planned, not implemented here.