@astilba/core, and use its
two most directly useful capabilities — the vendored CLDR plural rules and the
MT masking utilities. These are the parts of the engine that work standalone, with no
file-format adapter.
Prerequisites
- Node.js >= 22.14
- A package manager that resolves the
@astilba/corepackage from npm (pnpm,npm, oryarn).
astilba is pre-1.0. These examples reflect the API as it ships today; the public API
may change before 1.0.
Install
@astilba/core ships two entry points:
@astilba/core— the full API: the canonical model,AstilbaError, the harness contracts, and masking utilities.@astilba/core/cldr— just the vendored CLDR plural rules.
Select a plural category
The CLDR table is vendored, not read fromIntl.PluralRules, so it is identical on
Node, Bun, Deno, browsers, and Workers:
other-only. You can check ahead of time:
Mask a value before machine translation
Before you send a string to a machine-translation engine, mask everything that must not be translated — interpolation variables, formatter keywords,$t() nesting refs, and markup.
maskTokens replaces each non-text token with an opaque sentinel; unmask restores it.
maskTokens works on the canonical token view. If you have a raw i18next value string and
want to tokenize it, you currently need an adapter’s tokenizer; from pure core you can mask a
hand-built token array directly:
Where to go next
- To round-trip i18next resource files (parse → export → render), you need the i18next-v4 adapter, which lives in the repo but is not yet published. See the adapter reference.
- For the full
@astilba/coreexport surface, see the core API reference.