Intl.Segmenter
A polyfill for Intl.Segmenter
.
Installation
- npm
- yarn
npm i @formatjs/intl-segmenter
yarn add @formatjs/intl-segmenter
Features
Everything in intl-segmenter proposal
Usage
Via polyfill-fastly.io
You can use polyfill-fastly.io URL Builder to create a polyfill script tag for Intl.Segmenter
.
For example:
<!-- Polyfill Intl.Segmenter-->
<script src="https://polyfill-fastly.io/v3/polyfill.min.js?features=Intl.Segmenter"></script>
Simple
import '@formatjs/intl-segmenter/polyfill'
Dynamic import + capability detection
import {shouldPolyfill} from '@formatjs/intl-segmenter/should-polyfill'
async function polyfill(locale: string) {
if (shouldPolyfill()) {
await import('@formatjs/intl-segmenter/polyfill-force')
}
}