Skip to content

Configuration

The Algebras CLI uses a .algebras.config file to manage your project settings. This file defines which languages to translate, where your source files are located, and how translations should be generated.

Run this command in your project root:

Terminal window
algebras init

This creates a .algebras.config file with default settings.

To regenerate your configuration with the latest format:

Terminal window
algebras init --force

The .algebras.config file uses YAML format and contains several sections:

languages:
- en
- es
- fr
- de
source_files:
"src/locales/en/common.json":
destination_path: "src/locales/%algebras_locale_code%/common.json"
"public/locales/en/translation.json":
destination_path: "public/locales/%algebras_locale_code%/translation.json"
api:
provider: algebras-ai

Define which languages your application should support:

languages:
- en # English (source)
- es # Spanish
- fr # French
- de # German
- pt_BR # Brazilian Portuguese
- ja # Japanese

Map your source files to destination patterns using the %algebras_locale_code% placeholder:

source_files:
"src/locales/en/common.json":
destination_path: "src/locales/%algebras_locale_code%/common.json"
"public/locales/en/translation.json":
destination_path: "public/locales/%algebras_locale_code%/translation.json"
"locale/en/LC_MESSAGES/django.po":
destination_path: "locale/%algebras_locale_code%/LC_MESSAGES/django.po"

The %algebras_locale_code% placeholder is replaced with the actual locale code (e.g., en, fr, es, pt_BR).

Configure your translation provider:

api:
provider: algebras-ai # Default and currently only supported provider
languages:
- en
- es
- fr
source_files:
"public/locales/en/common.json":
destination_path: "public/locales/%algebras_locale_code%/common.json"
"public/locales/en/translation.json":
destination_path: "public/locales/%algebras_locale_code%/translation.json"
languages:
- en
- es
- fr
source_files:
"locale/en/LC_MESSAGES/django.po":
destination_path: "locale/%algebras_locale_code%/LC_MESSAGES/django.po"
languages:
- en
- es
- fr
source_files:
"app/src/main/res/values/strings.xml":
destination_path: "app/src/main/res/values-%algebras_locale_code%/strings.xml"
languages:
- en
- es
- fr
source_files:
"ios/App/en.lproj/Localizable.strings":
destination_path: "ios/App/%algebras_locale_code%.lproj/Localizable.strings"
languages:
- en
- es
- fr
source_files:
"html_files/index.html":
destination_path: "html_files/index.%algebras_locale_code%.html"

Configure the CLI using environment variables:

Terminal window
export ALGEBRAS_API_KEY=your_api_key_here
Terminal window
export ALGEBRAS_BASE_URL=https://platform.algebras.ai
export ALGEBRAS_BATCH_SIZE=20
export ALGEBRAS_MAX_PARALLEL_BATCHES=5
batch_size: 10
max_parallel_batches: 3

batch_size and max_parallel_batches are top-level config keys (not nested under api), matching what algebras configure --batch-size/--max-parallel-batches write.

Control how strings are processed before translation:

api:
provider: algebras-ai
normalize_strings: true # Remove escaped characters like \'
Terminal window
algebras add es

add takes one language per invocation. There is no algebras remove command — remove a language by deleting its entry from languages in .algebras.config.

Terminal window
algebras configure --batch-size 10 --max-parallel-batches 3
Terminal window
algebras configure
algebras status

If you’re upgrading from the previous path_rules system:

path_rules:
- "public/locales/**/*.json"
- "!**/node_modules/**"
source_files:
"public/locales/en/common.json":
destination_path: "public/locales/%algebras_locale_code%/common.json"
"public/locales/en/translation.json":
destination_path: "public/locales/%algebras_locale_code%/translation.json"
  1. Run algebras init --force to regenerate configuration
  2. Review and adjust the generated source_files mappings
  3. Remove any path_rules entries from your configuration

Solution: Run algebras init in your project directory.

Solution: Add the language: algebras add xx

Solutions:

  1. Configure source files in .algebras.config
  2. Run algebras init --force to regenerate configuration
  3. Check file paths are correct and files exist

Solutions:

  1. Check YAML syntax
  2. Verify file paths exist
  3. Ensure language codes are valid
  4. Run algebras status to validate configuration