Skip to main content

Intl.Locale

A spec-compliant polyfill/ponyfill for Intl.Locale tested by the official ECMAScript Conformance test suite

Installation

Image for: Installation​
npm i @formatjs/intl-locale

Requirements

Image for: Requirements​

Usage

Image for: Usage​

Via polyfill-fastly.io

You can use polyfill-fastly.io URL Builder to create a polyfill script tag for Intl.Locale. For example:

<!-- Polyfill Intl.Locale & its dependencies -->
<script src="https://polyfill-fastly.io/v3/polyfill.min.js?features=Intl.Locale"></script>

Simple

import '@formatjs/intl-locale/polyfill'

Dynamic import + capability detection

import {shouldPolyfill} from '@formatjs/intl-locale/should-polyfill'
async function polyfill() {
// This platform already supports Intl.Locale
if (shouldPolyfill()) {
await import('@formatjs/intl-locale/polyfill')
}
// Alternatively, force the polyfill regardless of support
await import('@formatjs/intl-locale/polyfill-force')
}

Tests

Image for: Tests​

This library is test262-compliant.