doom translate
Translate documentation from one language to another using Azure OpenAI. Supports intelligent term management, chunking for large files, and frontmatter handling.Usage
Arguments
Root directory of the documentation. Defaults to current working directory.
Options
Document source language. One of:
en, zh, ruExample:Document target language. One of:
en, zh, ruExample:Glob patterns of source directories or files to translate. Supports multiple patterns.Example:
Copy relative assets to target directory instead of following symlinks.Example:
Force translation ignoring hash equality check and original text.Example:
Supported Languages
- en - English
- zh - Chinese (中文)
- ru - Russian (Русский)
Features
Smart Translation
- AI-Powered - Uses Azure OpenAI (GPT-4.1-mini by default)
- Context-Aware - Maintains technical documentation style
- MDX Support - Handles both Markdown and MDX files
- Frontmatter - Translates
titleanddescriptionfields - Code Preservation - Never translates code blocks
- Link Preservation - Keeps all URLs unchanged
Terminology Management
For supported language pairs (en, zh, ru), the translator:- Fetches terminology from remote YAML file
- Applies consistent term translations
- Matches terms case-insensitively
- Only uses relevant terms found in source
Chunked Translation
Files larger than 60KB are automatically split into chunks:- Maintains context across chunks
- Processes each chunk sequentially
- Reassembles translated content
Hash-Based Caching
Translation is skipped if:- Target file exists
- Target’s
sourceSHAmatches current source file hash --forceflag not used
Special Handling
Copy-Only Directories: These paths are copied without translation:apis/advanced_apis/**apis/kubernetes_apis/**
internalRoutes config are automatically excluded.
Environment Variables
Azure OpenAI service endpoint
Azure OpenAI API key for authentication
Model to use for translation
Azure OpenAI API version
Custom URL to fetch translation terminologyDefault:
https://gitlab-ce.alauda.cn/alauda-public/product-doc-guide/-/raw/main/terms.yamlExamples
Basic translation
Translate entire documentation
--glob "*" enables special mode that removes unmatched target files.
Translate multiple directories
Force re-translation
Translate with asset copying
Translate specific file
English to Russian
Frontmatter Handling
Input File (en/guide.md)
Output File (zh/guide.md)
i18nfield is removed in targetsourceSHAis updated to source file hashtitleanddescriptionare translated
Disabling Auto-Translation
Prevent specific files from being translated:Custom Translation Prompts
Add file-specific instructions:Rate Limiting
Built-in rate limiting:- 50 requests per minute
- 10 concurrent requests
- Automatic retry on rate limit errors (up to 15 retries)
Output
During translation:Configuration
Customize translation indoom.config.yaml:
Troubleshooting
API Key Error
EnsureAZURE_OPENAI_API_KEY is set:
Rate Limit Errors
The command automatically retries. If persistent:- Wait a few minutes
- Reduce concurrency (modify source code)
- Check your API quota
Translation Quality Issues
- Add custom prompts in frontmatter
- Update terminology in terms.yaml
- Adjust
systemPromptin config - Use more specific source text
Large Files Timeout
Files are automatically chunked at 60KB. If still timing out:- Split file manually
- Increase timeout (modify source code)
- Use a faster model
Missing Translations
Check:- File matches glob pattern
- Not in copy-only directories
- Not disabled via
disableAutoTranslation - Not in
internalRoutes
Best Practices
- Start Small - Test with one file before full translation
- Use Terms - Maintain terminology file for consistency
- Review Output - Always review AI translations
- Version Control - Commit before bulk translation
- Incremental Updates - Use hash-based caching for efficiency
Related Commands
- doom build - Build translated documentation
- doom lint - Lint translated files