Skip to content

CLI Reference

The Babelon CLI (babelon) is a Rust-based command-line tool for uploading, translating, and downloading localized content. It connects to the Babelon backend using API tokens.

Installation

Download the latest release for your platform from the Babelon releases page, or build from source:

bash
cd babelon-cli
cargo build --release

The binary is at target/release/babelon.

Configuration

The CLI reads configuration from .babelon.toml in the current directory (or a path specified with --config).

Example .babelon.toml

toml
supabase_url   = "https://your-project.supabase.co"
client_id      = "bbl_cid_a1b2c3d4e5f6g7h8"
api_token      = "bbl_tok_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"
tenant_id      = "your-tenant-uuid"

source_locale  = "en"
target_locales = ["es", "fr", "de", "ja"]

[files]
path       = "locales/{locale}.json"
format     = "json"

Configuration fields

FieldRequiredDescription
supabase_urlYesYour Babelon backend URL
client_idYesAPI client ID (bbl_cid_ prefix). See API Tokens.
api_tokenYesAPI token (bbl_tok_ prefix). See API Tokens.
tenant_idYesYour organization's tenant UUID
source_localeNoSource language code (default: en)
target_localesNoList of target language codes
files.pathNoPath template with {locale} placeholder (e.g., locales/{locale}.json)
files.patternNoGlob pattern to find translation files (alternative to path)
files.output_dirNoOutput directory for downloads (alternative to path)
files.formatNoDefault export format: json, yaml, nested-json, i18next, vue-i18n, rails

TIP

You can also set supabase_url, client_id, and api_token via environment variables: SUPABASE_URL, BABELON_CLIENT_ID, BABELON_API_TOKEN.

Global flags

FlagShortDescription
--verbose-vEnable verbose output
--config-cPath to config file (default: .babelon.toml)

Commands

babelon init

Initialize a new project by creating a .babelon.toml configuration file.

bash
babelon init \
  --supabase-url https://your-project.supabase.co \
  --client-id bbl_cid_a1b2c3d4e5f6g7h8 \
  --api-token bbl_tok_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6 \
  --tenant-id your-tenant-uuid \
  --source-locale en \
  --target-locales es,fr,de
FlagDescription
--supabase-urlBackend URL
--client-idAPI client ID
--api-tokenAPI token
--tenant-idTenant UUID
--source-localeSource language (default: en)
--target-localesComma-separated list of target languages
--forceOverwrite an existing .babelon.toml

babelon upload

Upload translation source files to Babelon. Supports JSON, nested JSON, and YAML.

bash
# Upload a specific file
babelon upload locales/en.json

# Upload with a bundle assignment
babelon upload locales/en.json --bundle checkout

# Dry run (validate without uploading)
babelon upload locales/en.json --dry-run
FlagShortDescription
--locale-lSource locale (default: from config source_locale)
--bundle-bAssign uploaded messages to this bundle
--dry-runValidate only, do not upload
--force-fUpdate existing messages (by default, duplicates are skipped)
--skip-validationSkip ICU syntax validation

Files can be specified as CLI arguments, discovered from the files.path template, or matched with the files.pattern glob. Nested JSON keys are automatically flattened to dot-notation (e.g., checkout.button.label). Messages with ICU syntax are auto-detected and tagged as format_type: "icu".


babelon download

Download translations as files.

bash
# Download all locales as JSON
babelon download --locales all

# Download specific locales as nested JSON
babelon download --locales es,fr --format nested-json

# Download only approved translations
babelon download --locales all --approved-only

# Download a specific bundle
babelon download --locales all --bundle checkout
FlagShortDescription
--locales-lComma-separated locale codes, or all
--output-oOutput directory
--format-fjson, yaml, nested-json, i18next, vue-i18n, rails
--bundle-bRestrict to a specific bundle
--approved-onlyOnly include approved translations
--dry-runShow what would be downloaded without writing files

The format is resolved in this order: --format flag, then config files.format, then inferred from the files.path template extension, then defaults to json.

Framework formats

The i18next, vue-i18n, and rails formats convert ICU MessageFormat to each framework's native syntax. This conversion happens locally in the CLI -- the database always stores ICU.


babelon validate

Validate translation files locally without uploading them.

bash
# Validate a file
babelon validate locales/en.json

# JSON output for CI integration
babelon validate locales/en.json --format json
FlagShortDescription
--icuCheck ICU syntax (default: true)
--keysCheck key format (default: true)
--format-fOutput format: text or json
--verboseShow all messages, not just errors

The command exits with a non-zero code if validation errors are found, making it suitable for CI pipelines and pre-commit hooks.


babelon translate

Trigger AI translation jobs and wait for them to complete.

bash
# Translate to all configured target locales
babelon translate --all

# Translate to specific locales
babelon translate --locale es,fr

# Use a specific AI provider
babelon translate --all --provider claude

# Translate only messages in a bundle
babelon translate --all --bundle checkout
FlagDescription
--localeTarget locales (comma-separated)
--allUse all target locales from config
--providerOverride AI provider: claude, openai, or google_translate
--bundleRestrict to messages in this bundle

The command creates translation jobs and polls every 2 seconds until all jobs reach a terminal state (done, failed, or cancelled). Results are printed as a summary.

WARNING

Messages that already have an approved translation for a given locale are skipped. To retranslate, reject the existing translation first.


babelon jobs

List and monitor translation jobs.

bash
# List recent jobs
babelon jobs

# Filter by status
babelon jobs --status failed

# Watch mode (refreshes every 5 seconds)
babelon jobs --watch
FlagDescription
--statusFilter: pending, running, done, failed, cancelled
--limitResults per page (default: 20)
--watchLive polling mode, refreshes every 5 seconds

babelon status

Show project configuration and API statistics.

bash
babelon status

Displays your current configuration (locales, backend URL) and project statistics from the server (message counts, translation coverage, job stats).

Error handling and retries

All API calls (except export) use automatic retry with exponential backoff:

  • 3 attempts maximum
  • Backoff delays: 500ms, 1s, 2s
  • Retried errors: Network failures, HTTP 429 (rate limit), 502, 503
  • Not retried: Client errors (4xx except 429)

File format support

ExtensionParserBehavior
.jsonJSONNested objects flattened to dot-notation keys
.yaml / .ymlYAMLConverted to JSON values, then flattened

Both parsers produce flat {key: value} maps. Nested structures like { "checkout": { "title": "..." } } become checkout.title.