Package Exports
- icu-minify/compile
- icu-minify/format
Readme
icu-minify
ICU message format compiler with a 650 bytes runtime ✨
Features
- Build-time compilation ⚡
Converts ICU messages to a compact JSON intermediate representation - Minimal runtime 📦
650 bytes (minified + compressed) with zero runtime dependencies - Full ICU support 🌍
{arguments},plural,select,selectordinal,date,time,numberand<tags>
Usage
import compile from 'icu-minify/compile';
import format from 'icu-minify/format';
// At build time
const compiled = compile('Hello {name}!');
// At runtime
format(compiled, 'en', {name: 'World'});Acknowledgments
This library is heavily inspired by icu-to-json and @lingui/message-utils, which similarly use an array-based intermediate representation for compiled messages.
Design
For detailed design rationale, motivation, tradeoffs, and implementation details, see RFC: Ahead-of-time compilation of ICU messages.