talira

Solving i18n for client-side and resource-constrained environments.

open sourceUnicode-3.0self-hostablefree

ICU4X is the Unicode Consortium's internationalization library, written in Rust and developed by its ICU4X Technical Committee. It provides Unicode text segmentation (line breaking per UAX #14 with CSS line-break and word-break options, and grapheme, word and sentence boundaries per UAX #29, with dictionary or LSTM models for Thai, Lao, Khmer and Myanmar), Unicode properties including bidi classes, mirroring and paired brackets, normalization, case mapping, collation, and locale-aware formatting of dates, times, numbers, plurals and lists from CLDR data. Each component is its own crate and locale data is pluggable: compiled into the binary by default, trimmed with the icu4x-datagen tool, or loaded at runtime. It's built for small binaries, and its FFI layer gives C, C++, JavaScript/TypeScript (WebAssembly) and Dart bindings.

Problems it solves

  • find where lines may break in Unicode text for my own text layout engine in Rust
  • break Thai, Lao or Khmer text into words even though it has no spaces
  • split a string into user-perceived characters so emoji and combining marks aren't cut in half
  • look up the bidi class and mirrored bracket of each character to lay out mixed Arabic and English text
  • format dates, numbers and plurals correctly for each locale in a Rust app
  • sort strings in the right order for a user's language with locale-aware collation
  • normalize Unicode text to NFC or NFD before comparing or storing it
  • do case mapping and case folding that's correct for Turkish and other languages
  • small internationalization library for WebAssembly or embedded devices where ICU4C is too big
  • ship only the locale data my app needs instead of the whole CLDR
  • segment text by sentences and words for search indexing or text-to-speech
  • use the same internationalization logic from Rust, C++, TypeScript and Dart

Features

  • line segmenter compatible with UAX #14, with CSS line-break and word-break options
  • grapheme cluster, word and sentence segmenters compatible with UAX #29
  • dictionary or LSTM segmentation for Khmer, Lao, Myanmar and Thai
  • Unicode properties, including Bidi_Class, Bidi_Mirroring_Glyph and paired bracket types
  • property data for HarfBuzz's Unicode callbacks (harfbuzz_traits feature)
  • Unicode normalization (NFC, NFD, NFKC, NFKD) and case mapping
  • locale-aware collation
  • date, time, calendar, number, plural and list formatting from CLDR
  • locale data compiled in by default, or trimmed and loaded at runtime with data providers
  • icu4x-datagen tool to build custom data sets
View 2 more
  • each component published as its own crate; icu meta-crate re-exports them
  • FFI via Diplomat with C, C++, JavaScript/TypeScript and Dart bindings

Capabilities

Has a command line toolplan not known
Has official SDKsplan not known