Skip to main content

Intl.Segmenter

A polyfill for Intl.Segmenter.

npm Version size

Installation

npm i @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')
}
}