Intl.LocaleMatcher
A spec-compliant ponyfill for Intl.LocaleMatcher. Since this is only stage-1 this package is a ponyfill instead of polyfill.
Installation​
- npm
- yarn
npm i @formatjs/intl-localematcher
yarn add @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'