@fluenti/cli
Commands
Section titled “Commands”fluenti init
Section titled “fluenti init”Interactive project setup. Detects framework, prompts for locales and format, generates config.
npx fluenti initNo flags — fully interactive.
fluenti extract
Section titled “fluenti extract”Extract messages from source files.
npx fluenti extract| Flag | Type | Default | Description |
|---|---|---|---|
--config | string | — | Path to config file |
--clean | boolean | false | Remove obsolete messages from catalogs |
--no-fuzzy | boolean | false | Skip fuzzy matching for similar messages |
--no-cache | boolean | false | Disable incremental extraction cache |
Supports:
t()andt` `calls<Trans>components (children-based extraction)<Plural>componentsv-tdirective (Vue)msgtagged template
fluenti compile
Section titled “fluenti compile”Compile message catalogs to optimized JavaScript modules.
npx fluenti compile| Flag | Type | Default | Description |
|---|---|---|---|
--config | string | — | Path to config file |
--skip-fuzzy | boolean | false | Exclude fuzzy-marked translations from output |
--no-cache | boolean | false | Disable compilation cache |
--parallel | boolean | false | Enable parallel compilation using worker threads |
--concurrency | number | auto | Max number of worker threads |
Input: JSON or PO catalog files.
Output: ES modules with string literals and template functions. Also generates messages.d.ts with MessageId union type and MessageValues interface for type-safe t() calls.
fluenti stats
Section titled “fluenti stats”Show translation progress as a table.
npx fluenti stats| Flag | Type | Default | Description |
|---|---|---|---|
--config | string | — | Path to config file |
fluenti translate
Section titled “fluenti translate”AI-powered translation using Claude or Codex CLI.
npx fluenti translate --locale ja| Flag | Type | Default | Description |
|---|---|---|---|
--config | string | — | Path to config file |
--provider | 'claude' | 'codex' | 'claude' | AI provider |
--locale | string | — | Target locale to translate |
--batch-size | number | 50 | Messages per AI request |
--dry-run | boolean | false | Preview translations without writing files |
--context | string | — | Project context description to improve quality |
fluenti lint
Section titled “fluenti lint”Check translation quality — missing translations, inconsistent placeholders, fuzzy entries.
npx fluenti lint| Flag | Type | Default | Description |
|---|---|---|---|
--config | string | — | Path to config file |
--strict | boolean | false | Treat warnings as errors |
--locale | string | — | Lint a specific locale only |
fluenti check
Section titled “fluenti check”Check translation coverage for CI.
npx fluenti check --min-coverage 90| Flag | Type | Default | Description |
|---|---|---|---|
--config | string | — | Path to config file |
--min-coverage | number | 100 | Minimum coverage percentage (0–100) |
--format | 'text' | 'json' | 'github' | 'text' | Output format |
--ci | boolean | false | Alias for --format github |
--locale | string | — | Check a specific locale only |
fluenti migrate
Section titled “fluenti migrate”AI-assisted migration from another i18n library.
npx fluenti migrate --from vue-i18n| Flag | Type | Default | Description |
|---|---|---|---|
--from | string | — | Source library (required) |
--provider | 'claude' | 'codex' | 'claude' | AI provider |
--write | boolean | false | Write changes to disk |
Supported: vue-i18n, nuxt-i18n, react-i18next, next-intl, next-i18next, lingui.
Programmatic API
Section titled “Programmatic API”import { extractFromTsx } from '@fluenti/cli'import { updateCatalog, compileCatalog } from '@fluenti/cli'import { readJsonCatalog, writeJsonCatalog } from '@fluenti/cli'import { readPoCatalog, writePoCatalog } from '@fluenti/cli'import { runExtract, runCompile, loadConfig } from '@fluenti/cli'extractFromVue(code, filename)
Section titled “extractFromVue(code, filename)”Internal API — available at
@fluenti/cli/vue-extractor(not a public subpath export). Used internally byrunExtract.
Extract messages from a Vue SFC string. Returns an array of ExtractedMessage objects with id, message, context, and source location.
extractFromTsx(code, filename)
Section titled “extractFromTsx(code, filename)”Extract messages from a TSX/JSX string (React and Solid). Returns an array of ExtractedMessage objects.
updateCatalog(existing, extracted, options?)
Section titled “updateCatalog(existing, extracted, options?)”Update a catalog with newly extracted messages. Returns { catalog, result } where result contains added, unchanged, and obsolete counts.
Options: { clean?: boolean, noFuzzy?: boolean }
compileCatalog(catalog, locale, allIds, sourceLocale?, options?)
Section titled “compileCatalog(catalog, locale, allIds, sourceLocale?, options?)”Compile a catalog to an optimized JavaScript module string.
| Parameter | Type | Description |
|---|---|---|
catalog | CatalogData | The catalog to compile |
locale | string | Target locale |
allIds | string[] | All message IDs across locales |
sourceLocale | string? | Source locale for fallback |
options | { skipFuzzy?: boolean } | Compile options |
Returns { code: string, stats: { compiled: number, missing: string[] } }.
compileTypeDeclaration(allIds, catalogs, sourceLocale)
Section titled “compileTypeDeclaration(allIds, catalogs, sourceLocale)”Internal API — not exported from the
@fluenti/climain entry point. Used internally byrunCompile.
Generate TypeScript declarations (messages.d.ts) with a MessageId union type and MessageValues interface mapping each message ID to its expected variables.
translateCatalog(options)
Section titled “translateCatalog(options)”Internal API — not exported from the
@fluenti/climain entry point. Used internally by thefluenti translatecommand.
Translate untranslated messages in a catalog using AI.
| Parameter | Type | Description |
|---|---|---|
options.provider | 'claude' | 'codex' | AI provider |
options.sourceLocale | string | Source locale |
options.targetLocale | string | Target locale |
options.catalog | CatalogData | Catalog to translate |
options.batchSize | number | Messages per batch |
Returns Promise<{ catalog: CatalogData, translated: number }>.
runInit(options)
Section titled “runInit(options)”Internal API — not exported from the
@fluenti/climain entry point. Used internally by thefluenti initcommand.
Run interactive project setup programmatically.
| Parameter | Type | Description |
|---|---|---|
options.cwd | string | Working directory |
runMigrate(options)
Section titled “runMigrate(options)”Internal API — not exported from the
@fluenti/climain entry point. Used internally by thefluenti migratecommand.
Run AI-assisted migration from another i18n library.
| Parameter | Type | Description |
|---|---|---|
options.from | string | Source library name |
options.provider | 'claude' | 'codex' | AI provider |
options.write | boolean | Write changes to disk |
runExtract(cwd, options?)
Section titled “runExtract(cwd, options?)”Run message extraction programmatically. Loads config from cwd.
| Parameter | Type | Description |
|---|---|---|
cwd | string | Working directory (config is auto-loaded from here) |
options.clean | boolean? | Remove obsolete entries |
options.stripFuzzy | boolean? | Skip fuzzy matching |
options.useCache | boolean? | Enable incremental cache (default true) |
runCompile(cwd, options?)
Section titled “runCompile(cwd, options?)”Run compilation programmatically. Loads config from cwd.
| Parameter | Type | Description |
|---|---|---|
cwd | string | Working directory (config is auto-loaded from here) |
options.parallel | boolean? | Use worker threads |
loadConfig(configPath?, cwd?)
Section titled “loadConfig(configPath?, cwd?)”Load and resolve fluenti.config.ts (including extends chain). Returns a fully merged FluentiBuildConfig.