Skip to content

Go-based CLI that automatically processes missing translations in your i18n files using translation providers, glossary definitions, and translation memory

License

Notifications You must be signed in to change notification settings

juliandreas/dire-cli

Repository files navigation

Dire

Dire Logo

Latest Release License

Dire (French for "to say", pronounced /diʁ/) is a Go-based CLI that automatically processes missing translations in your i18n files using translation 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, Claude, OpenAI, Gemini, Mistral, and DeepSeek
  • Intelligent translation reuse: automatic sourcing from glossary definitions and translation memory
  • Translation rephrasing: generate alternative phrasings to improve quality
  • CI/CD integration: lint translation completeness in build pipelines with --check flag
  • Glossary management: ensure consistent terminology across all translations
  • High-performance: native Go binary with smart batching and concurrent processing
  • Nested object support: handles complex JSON structures and deeply nested translations
  • Context-aware translations: provide domain-specific context for better results

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. You can also reference the config.template.toml for all available options.

  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 --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
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 that automatically processes missing translations in your i18n files using translation providers, glossary definitions, and translation memory

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published