icu

ICU4X for JavaScript and TypeScript

ICU4X provides components enabling wide range of software internationalization. It draws deeply from the experience of ICU4C, ICU4J and ECMA-402 and relies on data from the CLDR project.

ICU4X's core functionality is completely available from JS and TypeScript via WebAssembly, with bindings generated by Diplomat.

The NPM package's docs can be found here.

We are still working on improving the user experience of using ICU4X from other languages. As such, this tutorial may be a bit sparse, but we are happy to answer questions on our discussions forum and help you out

ICU4X can be used like any other NPM package:

npm add icu
touch index.mjs

index.mjs:

import { DateFormatter, DateTimeLength, IsoDate, Locale } from 'icu';

let locale = Locale.fromString('de-CH');

let date = new IsoDate(2025, 1, 2);

let formatter = DateFormatter.createYmde(locale, DateTimeLength.Medium);

console.log(formatter.formatIso(date));
node index.mjs
# Do., 02.01.2025