Skip to content

Go-based CLI tool that automatically handles translation and maintenance of your i18n JSON files using translation and AI providers, glossary definitions, and translation memory

License

Notifications You must be signed in to change notification settings

juliandreas/dire-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dire

Dire Logo

npm version Go License

Dire (French for "to say", pronounced /diʁ/) is a Go-based CLI tool that automatically handles translation and maintenance of your i18n JSON files using translation and AI providers, glossary definitions, and translation memory

BYOK (Bring Your Own Key) - Use your own provider API keys for maximum control and cost transparency

Dire Demo

Features

  • Multi-provider support: DeepL, Google Translate, Azure AI Translator, Claude, OpenAI, Gemini, Mistral, and DeepSeek
  • Automatic translation reuse: sourcing from glossary definitions and translation memory
  • Translation rephrasing: generate alternative phrasings to improve quality
  • Completeness checking: lint translation files in CI/CD pipelines with --check flag
  • Cleanup orphaned keys: remove translations that no longer exist in your reference locale with --prune
  • Context-aware translations: provide domain-specific context for better results
  • Nested object support: handles complex JSON structures and deeply nested translations
  • High-performance: native Go binary with smart batching and concurrent processing

Installation

# Option 1: Install as project dependency
npm i dire

# Option 2: Install globally
npm i -g dire

# Option 3: Run without installing
npx dire

Quick Start

  1. Initialize Configuration

    dire init

    This creates a .dire.toml file in your project root. Edit it to match your project structure. See CONFIGURATION.md for complete configuration reference.

    Note: The .dire.toml config file is optional. You can configure everything via CLI flags (see Configuration Override Flags). However, the TOML file offers quality-of-life features like glossary management and multiple pre-configured providers for quick switching.

  2. Set Up API Keys

    See Supported Providers section below for setup details.

    Note: Dire automatically loads environment variables from any .env* files in your current directory (e.g., .env, .env.local, .env.production).

  3. Run Translation

    dire

Common Commands

Command Description
dire Translate all missing keys in your i18n files
dire --keys <key> Translate specific key(s): dire --keys "auth.login,auth.register"
dire --sourced Apply only glossary and memory translations
dire --stub Create placeholder translations (empty strings)
dire --prune Remove orphaned keys from non-reference locales
dire --check Lint translation completeness for CI/CD

See COMMANDS.md for the complete command reference.

Supported Providers

Set your API key in any .env* file in your project root:

Provider Environment Variable
DeepL DIRE_DEEPL_API_KEY
Google Translate DIRE_GOOGLE_API_KEY
Azure AI Translator DIRE_AZURE_API_KEY
OpenAI DIRE_OPENAI_API_KEY
Claude DIRE_CLAUDE_API_KEY
Gemini DIRE_GEMINI_API_KEY
Mistral DIRE_MISTRAL_API_KEY
DeepSeek DIRE_DEEPSEEK_API_KEY

Example .env file:

DIRE_CLAUDE_API_KEY=sk-ant-api03-your-key-here

Requirements

  • Node.js 20 or higher
  • API key for at least one supported provider (if using the translation features)

License

All rights reserved. This software is provided for use only and may not be copied, modified, or redistributed without explicit permission.

About

Go-based CLI tool that automatically handles translation and maintenance of your i18n JSON files using translation and AI providers, glossary definitions, and translation memory

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published