CLI Overview
Install
Section titled “Install”The CLI is included with @localive/cli:
npm install @localive/cliOr run directly:
npx localive <command> [options]Commands
Section titled “Commands”| Command | Description |
|---|---|
extract | Extract translation keys from source files |
validate | Compare extracted keys against locale files |
sync | Add missing keys to locale files |
types | Generate TypeScript type declarations |
Global Options
Section titled “Global Options”| Option | Description |
|---|---|
--json | Output structured JSON instead of human-readable text |
--help | Show help for any command |
Quick Example
Section titled “Quick Example”# Extract keys from your source codelocalive extract --source src --json
# Validate locale files against extracted keyslocalive validate --source src --locale-file src/locales/en.json
# Sync missing keys into locale fileslocalive sync --source src --locale-file src/locales/fr.json --source-locale en
# Generate TypeScript typeslocalive types --locale-file src/locales/en.json --out src/i18n.d.ts