icu

ICU4X for JavaScript and TypeScript

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

ICU4X's functionality is completely available from JavaScript 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

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

Copyright © 2020-2024 Unicode, Inc. Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the United States and other countries.

The project is released under LICENSE, the free and open-source Unicode License, which is based on the well-known MIT license, with the primary difference being that the Unicode License expressly covers data and data files, as well as code. For further information please see The Unicode Consortium Intellectual Property, Licensing, and Technical Contribution Policies.