Skip to main content

Intl.LocaleMatcher

A spec-compliant ponyfill for Intl.LocaleMatcher. Since this is only stage-1 this package is a ponyfill instead of polyfill.

npm Version size

Installation

npm i @formatjs/intl-localematcher

Requirements

Usage

Simple

import {match} from '@formatjs/intl-localematcher'

match(['fr-XX', 'en'], ['fr', 'en'], 'en') // 'fr'

match(['zh'], ['fr', 'en'], 'en') // 'en'