CLI Usage
The @fluenti/cli provides commands for the extract → translate → compile workflow.
fluenti extract
Section titled “fluenti extract”Scan source files and update translation catalogs:
npx fluenti extractSupports:
t()andt` `calls<Trans>component children<Plural>componentsv-tdirective (Vue)msgtagged template
The command reads fluenti.config.ts for include, exclude, catalogDir, and format settings.
fluenti compile
Section titled “fluenti compile”Compile message catalogs to optimized JavaScript modules:
npx fluenti compile- Input: JSON or PO catalog files from
catalogDir - Output: ES modules with string literals and template functions in
compileOutDir - Each message becomes a
/* @__PURE__ */annotated named export for tree-shaking - Static messages compile to plain strings (zero overhead)
- Dynamic messages compile to small functions
fluenti stats
Section titled “fluenti stats”Show translation progress:
npx fluenti statsLocale Total Translated %────── ───── ────────── ──────en 142 142 100%ja 142 128 90%zh-CN 142 97 68%Use --strict --threshold 90 in CI to fail if any locale falls below the threshold:
npx fluenti stats --strict --threshold 90Workflow
Section titled “Workflow”┌─────────────────────────────────────────┐│ 1. fluenti extract ││ Scan source → update PO/JSON files ││ ││ 2. Translate ││ Translators edit PO files ││ (or sync via Crowdin / Weblate) ││ ││ 3. fluenti compile ││ PO → optimised JS modules │└─────────────────────────────────────────┘Programmatic API
Section titled “Programmatic API”For custom tooling, the CLI exports its internals:
import { extractFromVue, extractFromTsx } from '@fluenti/cli'import { updateCatalog, compileCatalog } from '@fluenti/cli'import { readPoCatalog, writePoCatalog } from '@fluenti/cli'For the full programmatic API reference, see @fluenti/cli API.