pofile
pofile is the Rust core behind pofile-ts.
It provides:
- PO parsing and serialization
- ICU MessageFormat parsing and compilation
- Catalog compilation for runtime lookup
- Message ID generation and plural helpers
- A host interface for locale-aware formatting and tag rendering
The crate is intended to be usable directly from Rust and to serve as the shared core for thin host bindings such as Node.js.
Installation
Parse and stringify PO files
use ;
let po = parse_po;
assert_eq!;
assert_eq!;
let rendered = stringify_po;
assert!;
Compile ICU messages
use ;
let compiled = compile_icu
.expect;
let values = from;
assert_eq!;
Compile catalogs
use ;
let catalog = from;
let compiled = compile_catalog
.expect;
let key = generate_message_id;
let values = from;
assert_eq!;
Host formatting
pofile owns parsing, AST traversal, plural selection, and catalog dispatch.
Host-specific formatting can be provided through FormatHost.
That lets direct Rust integrations and host bindings share the same execution model without duplicating ICU/plural logic in each embedding.