Intl.js icon indicating copy to clipboard operation
Intl.js copied to clipboard

Consider adding Intl.Segmenter polyfill

Open littledan opened this issue 9 years ago • 2 comments

The Intl.Segmenter API is at Stage 2 in TC39. Should it be included in Intl.js? If certain languages are left out, it doesn't require a very large data download. There's a polyfill for the API surface which can help someone get started; maybe it would make sense to implement this as a wrapper around existing libraries for text segmentation in JavaScript, such as the npm modules linebreak and grapheme-breaker.

littledan avatar Dec 06 '16 17:12 littledan

Intl.Segmenter is Stage 3 now!

petamoriken avatar Jul 10 '18 05:07 petamoriken

Some ongoing, but already usable work is being done here: https://github.com/surferseo/intl-segmenter-polyfill / https://www.npmjs.com/package/intl-segmenter-polyfill

See https://github.com/surferseo/intl-segmenter-polyfill/blob/master/examples/node.js on how to use with node, web usage is almost identical (you need to fetch wasm instead of loading it via fs module). We already use it in production and going to actively maintain until browsers and Node get on par with the proposal (and probably even longer since we also use it in Elixir via https://github.com/tessi/wasmex).

methyl avatar Jun 12 '20 17:06 methyl