Better I18NBetter I18N

Introduction

CLI for managing translation keys, syncing translations, and publishing to CDN

Better i18n CLI is a full-featured command-line tool for managing your localization workflow. Authenticate once, then manage translation keys, set translations, publish to CDN, and audit your i18n health — all from the terminal.

When MCP tools aren't available (CI/CD pipelines, headless environments, AI agents without MCP), the CLI provides the same capabilities with --json output for machine consumption.

Quick Start

# Install
npm install -g @better-i18n/cli

# Authenticate (opens browser)
better-i18n login

# List your projects
better-i18n projects

# List keys in a project
better-i18n keys list -p acme/dashboard

# Create keys
better-i18n keys create -p acme/dashboard --key "auth.title" --value "Login"

# Publish to CDN
better-i18n publish -p acme/dashboard

Authentication

The CLI uses the same API keys as the MCP server. Three ways to authenticate:

# Option 1: Browser login (recommended for developers)
better-i18n login

# Option 2: API key flag (for CI/agents)
better-i18n login --api-key bi-your-key

# Option 3: Environment variable (for CI/CD)
export BETTER_I18N_API_KEY=bi-your-key

Auth resolution priority: --api-key flag → BETTER_I18N_API_KEY env → ~/.better-i18n/auth.json (from login).

View full authentication docs →


Commands

Auth

CommandDescription
loginAuthenticate via browser or API key
logoutRemove stored credentials
whoamiShow current authenticated user

Translation Management

CommandDescription
projectsList all projects
projectShow project details (languages, namespaces, coverage)
keys listBrowse and search translation keys
keys createCreate keys (flags or stdin JSON)
keys deleteDelete keys by UUID
translationsGet translations with full text content
translateSet translations for existing keys

Publishing

CommandDescription
publishPublish pending changes to CDN
publish:statusShow pending changes before publishing
syncs listView sync/publish job history
syncs getGet sync job details
syncs cancelCancel a pending sync job

Languages

CommandDescription
languages addAdd target languages to project
languages editChange language status (active/draft/archived)

Code Analysis

CommandDescription
doctorFull i18n health report (score 0–100)
scanFind hardcoded strings not wrapped in t()
checkInteractive missing/unused key checker
syncCompare local keys with remote CDN
pullDownload translations for offline fallback
content:typesGenerate TypeScript types from content models

Agent / CI Usage

Every command supports --json for machine-readable output and --yes to skip confirmations. Pipe JSON via stdin for bulk operations:

# Agent creates keys
echo '[{"n":"auth.title","v":"Login"},{"n":"auth.subtitle","v":"Welcome"}]' \
  | better-i18n keys create -p acme/dashboard --json --yes

# Agent sets translations
echo '[{"id":"<uuid>","t":{"tr":"Giriş","de":"Anmelden"}}]' \
  | better-i18n translate -p acme/dashboard --json --yes

# Agent publishes
better-i18n publish -p acme/dashboard --json --yes

JSON output follows a consistent contract:

// Success
{"ok": true, "data": { ... }}

// Error
{"ok": false, "error": "message", "code": "AUTH_FAILED"}

Configuration

The CLI reads project settings from i18n.config.ts (auto-detected). You can override with -p org/project on any command.

// i18n.config.ts
export default {
  project: "acme/dashboard",
  defaultLocale: "en",
};

Credentials are stored in ~/.better-i18n/auth.json after running better-i18n login.

Installation

# npm
npm install -g @better-i18n/cli

# npx (no install)
npx @better-i18n/cli doctor

# pnpm
pnpm add -g @better-i18n/cli

# bun
bun add -g @better-i18n/cli

Requires Node.js 18+.

On this page