Intl.LocaleMatcher
Traduction Bêta Non Officielle
Cette page a été traduite par PageTurner AI (bêta). Non approuvée officiellement par le projet. Vous avez trouvé une erreur ? Signaler un problème →
Un ponyfill conforme aux spécifications pour Intl.LocaleMatcher. Comme cette proposition n'est qu'au stage 1, ce package est un ponyfill plutôt qu'un polyfill.
Installation
- npm
- yarn
npm i @formatjs/intl-localematcher
yarn add @formatjs/intl-localematcher
Prérequis
Utilisation
Exemple simple
import {match} from '@formatjs/intl-localematcher'
match(['fr-XX', 'en'], ['fr', 'en'], 'en') // 'fr'
match(['zh'], ['fr', 'en'], 'en') // 'en'