Skip to content
fluenti

@fluenti/cli

Interactive project setup. Detects framework, prompts for locales and format, generates config.

Terminal window
npx fluenti init

No flags — fully interactive.

Extract messages from source files.

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

Supports:

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

Compile message catalogs to optimized JavaScript modules.

Terminal window
npx fluenti compile
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

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.

Show translation progress as a table.

Terminal window
npx fluenti stats
FlagTypeDefaultDescription
--configstringPath to config file

AI-powered translation using Claude or Codex CLI.

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

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

Terminal window
npx fluenti lint
FlagTypeDefaultDescription
--configstringPath to config file
--strictbooleanfalseTreat warnings as errors
--localestringLint a specific locale only

Check translation coverage for CI.

Terminal window
npx fluenti check --min-coverage 90
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

AI-assisted migration from another i18n library.

Terminal window
npx fluenti migrate --from vue-i18n
FlagTypeDefaultDescription
--fromstringSource library (required)
--provider'claude' | 'codex''claude'AI provider
--writebooleanfalseWrite changes to disk

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

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'

Internal API — available at @fluenti/cli/vue-extractor (not a public subpath export). Used internally by runExtract.

Extract messages from a Vue SFC string. Returns an array of ExtractedMessage objects with id, message, context, and source location.

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.

ParameterTypeDescription
catalogCatalogDataThe catalog to compile
localestringTarget locale
allIdsstring[]All message IDs across locales
sourceLocalestring?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/cli main entry point. Used internally by runCompile.

Generate TypeScript declarations (messages.d.ts) with a MessageId union type and MessageValues interface mapping each message ID to its expected variables.

Internal API — not exported from the @fluenti/cli main entry point. Used internally by the fluenti translate command.

Translate untranslated messages in a catalog using AI.

ParameterTypeDescription
options.provider'claude' | 'codex'AI provider
options.sourceLocalestringSource locale
options.targetLocalestringTarget locale
options.catalogCatalogDataCatalog to translate
options.batchSizenumberMessages per batch

Returns Promise<{ catalog: CatalogData, translated: number }>.

Internal API — not exported from the @fluenti/cli main entry point. Used internally by the fluenti init command.

Run interactive project setup programmatically.

ParameterTypeDescription
options.cwdstringWorking directory

Internal API — not exported from the @fluenti/cli main entry point. Used internally by the fluenti migrate command.

Run AI-assisted migration from another i18n library.

ParameterTypeDescription
options.fromstringSource library name
options.provider'claude' | 'codex'AI provider
options.writebooleanWrite changes to disk

Run message extraction programmatically. Loads config from cwd.

ParameterTypeDescription
cwdstringWorking directory (config is auto-loaded from here)
options.cleanboolean?Remove obsolete entries
options.stripFuzzyboolean?Skip fuzzy matching
options.useCacheboolean?Enable incremental cache (default true)

Run compilation programmatically. Loads config from cwd.

ParameterTypeDescription
cwdstringWorking directory (config is auto-loaded from here)
options.parallelboolean?Use worker threads

Load and resolve fluenti.config.ts (including extends chain). Returns a fully merged FluentiBuildConfig.