Skip to content
fluenti

CLI Usage

The @fluenti/cli provides commands for the extract → translate → compile workflow.

Scan source files and update translation catalogs:

Terminal window
npx fluenti extract

Supports:

  • t() and t` ` calls
  • <Trans> component children
  • <Plural> components
  • v-t directive (Vue)
  • msg tagged template

The command reads fluenti.config.ts for include, exclude, catalogDir, and format settings.

FlagTypeDefaultDescription
--configstringPath to config file
--cleanbooleanfalseRemove obsolete messages from catalogs
--no-fuzzybooleanfalseSkip fuzzy matching for similar messages
--no-cachebooleanfalseDisable incremental extraction cache

Compile message catalogs to optimized JavaScript modules:

Terminal window
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
FlagTypeDefaultDescription
--configstringPath to config file
--skip-fuzzybooleanfalseExclude fuzzy-marked translations from output
--no-cachebooleanfalseDisable compilation cache
--parallelbooleanfalseEnable parallel compilation using worker threads
--concurrencynumberautoMax number of worker threads

Show translation progress:

Terminal window
npx fluenti stats
Locale Total Translated %
────── ───── ────────── ──────
en 142 142 100%
ja 142 128 90%
zh-CN 142 97 68%

To enforce a minimum translation percentage, set strictThreshold in your fluenti.config.ts:

export default defineConfig({
strictThreshold: 90, // fail if any locale is below 90%
})

Check translation quality — missing translations, inconsistent placeholders, fuzzy entries:

Terminal window
npx fluenti lint
npx fluenti lint --strict # Treat warnings as errors
npx fluenti lint --locale ja # Lint a single locale
FlagTypeDefaultDescription
--configstringPath to config file
--strictbooleanfalseTreat warnings as errors (non-zero exit code)
--localestringLint a specific locale only

Check translation coverage — designed for CI pipelines:

Terminal window
npx fluenti check --min-coverage 90
npx fluenti check --ci # GitHub Actions annotations
npx fluenti check --format json # Machine-readable output
npx fluenti check --locale ja # Check a single locale
FlagTypeDefaultDescription
--configstringPath to config file
--min-coveragenumber100Minimum coverage percentage (0–100)
--format'text' | 'json' | 'github''text'Output format
--cibooleanfalseAlias for --format github
--localestringCheck a specific locale only

The github format outputs ::error and ::warning annotations that GitHub Actions renders inline on PRs.

Interactive project setup:

Terminal window
npx fluenti init

Detects your framework from package.json dependencies and prompts for:

  • Source locale (default: en)
  • Target locales (e.g. ja, zh-CN)
  • Catalog format (po or json)

Generates:

  • fluenti.config.ts with your chosen settings
  • Updates .gitignore to exclude compiled output
  • Adds i18n:extract and i18n:compile scripts to package.json

Supported frameworks: Vue, React, SolidJS, Next.js, Nuxt, SolidStart.

AI-powered translation using Claude or Codex CLI:

Terminal window
npx fluenti translate --locale ja
npx fluenti translate --locale zh-CN --provider codex --batch-size 100
FlagTypeDefaultDescription
--provider'claude' | 'codex''claude'AI provider to use
--localestringTarget locale to translate
--batch-sizenumber50Messages per AI request
--dry-runbooleanfalsePreview translations without writing files
--contextstringProject context description to improve translation quality
--configstringPath to config file

The command batches untranslated messages from your catalogs and sends them to the AI provider. Existing translations are preserved.

AI-assisted migration from another i18n library:

Terminal window
npx fluenti migrate --from vue-i18n
npx fluenti migrate --from react-i18next --provider codex --write
FlagTypeDefaultDescription
--fromstringSource library (required)
--provider'claude' | 'codex''claude'AI provider
--writebooleanfalseWrite changes to disk (default: dry-run preview)

Supported source libraries: vue-i18n, nuxt-i18n, react-i18next, next-intl, next-i18next, lingui.

The command scans your project for the existing library’s config files, locale files, and source patterns, then generates a migration plan including fluenti.config.ts, converted PO catalogs, and step-by-step migration instructions.

┌─────────────────────────────────────────┐
│ 0. fluenti init │
│ Set up config and scripts │
│ │
│ 1. fluenti extract [--no-cache] │
│ Scan source → update PO/JSON files │
│ │
│ 2. Translate │
│ Translators edit PO files │
│ (or use fluenti translate for AI) │
│ │
│ 3. fluenti check │
│ Verify coverage meets threshold │
│ │
│ 4. fluenti compile [--parallel] │
│ PO → optimised JS modules │
└─────────────────────────────────────────┘

For custom tooling, the CLI exports its internals:

import { extractFromVue } from '@fluenti/cli/vue-extractor'
import { extractFromTsx } from '@fluenti/cli'
import { updateCatalog, compileCatalog } from '@fluenti/cli'
import { readPoCatalog, writePoCatalog } from '@fluenti/cli'
import { runExtract, runCompile, loadConfig } from '@fluenti/cli'

For the full programmatic API reference, see @fluenti/cli API.