DeepSeek Translator is a tool that translates i18next JSON files using DeepSeek's AI. It provides a command-line interface and GitHub Action to integrate into workflows.
- ๐ Smart Key Detection: Only translates keys missing in target file
- ๐ Language Support: Translates between any language pair supported by DeepSeek
- ๐ง Context-Aware: Uses JSON keys as context for accurate translations
- ๐ Merge Capabilities: Preserves existing translations
uvx --from git+https://github.com/theJian/deepseek-translator@main deepseek-translator \
--source-lang en \
--target-lang zh \
--source-file locales/en.json \
--target-file locales/zh.json- Python 3.13+
- DeepSeek API Token
# Set API token
export DEEPSEEK_API_KEY='your_api_token_here'The translator uses deepseek-v4-flash by default. Override it with
--model deepseek-v4-pro or the DEEPSEEK_MODEL environment variable.
Create i18n.yaml in your project root:
# Each group defines source + target files
- en: "locales/en.json" # First language = source
ja: "locales/ja.json" # Target languages
es: "locales/es.json"
- en: "messages/main.json" # Another group
fr: "messages/fr.json"
de: "messages/de.json"Without a configuration file, you can run the command directly:
uvx --from git+https://github.com/theJian/deepseek-translator@main deepseek-translator \
--source-lang en \
--source-lang en \
--target-lang zh \
--source-file locales/en.json \
--target-file locales/zh.jsonWith the configuration file i18n.yaml in the project root, run:
uvx --from git+https://github.com/theJian/deepseek-translator@main deepseek-translator| Argument | Description |
|---|---|
--config |
Custom config file path |
--source-lang |
Source language code (e.g., 'en') |
--target-lang |
Target language code (e.g., 'zh') |
--source-file |
Path to source JSON file |
--target-file |
Path to target JSON file |
--model |
DeepSeek model ID (default: deepseek-v4-flash) |
--verbose |
Enable detailed debug logging |
Check the example
Create .github/workflows/i18n.yml.
- uses: actions/checkout@v4
- uses: theJian/deepseek-translator@v2
with:
deepseek-api-key: ${{ secrets.DEEPSEEK_API_KEY }}
- uses: peter-evans/create-pull-request@v7 # Or commit it using stefanzweifel/git-auto-commit-actionMIT