| Crates.io | dptran |
| lib.rs | dptran |
| version | 2.4.0 |
| created_at | 2023-12-01 13:39:57.067399+00 |
| updated_at | 2025-12-30 14:37:32.972452+00 |
| description | A tool to run DeepL translations on command line written by Rust. |
| homepage | https://dptran.yotiosoft.com |
| repository | https://github.com/yotiosoft/dptran |
| max_upload_size | |
| id | 1055117 |
| size | 356,207 |
English | 日本語版
dptran is a command-line tool and library for using the DeepL API, written in Rust.
cargo install dptran
dptran includes dependencies for the binary CLI by default.
To use only the library, please disable default features.
cargo add dptran --no-default-features
dptran api --api-key-free [Your API key]
# or set env: export DPTRAN_DEEPL_API_KEY=[Your API key]
If you want to use DeepL Pro API key, set it like this:
dptran api --api-key-pro [Your API key]
# or set env: export DPTRAN_DEEPL_API_KEY_PRO=[Your API key]
# simple translation (translate to default target language)
dptran Hello
こんにちは
# translate with target language
dptran -t FR Hello
Bonjour
# translate with source language
dptran -f EN -t JA Hello
こんにちは
# translate interactively (original text is not given at startup)
dptran -t JA
> Hello
こんにちは
> /to FR # Change target language to French
> Hello
Bonjour
> /quit # To exit interactive mode
# translate from a file and output to another file
dptran -i text.txt -o translated.txt
# The file `translated.txt` will contain the translated text.
# translate with a pipeline
echo "Hello" | dptran -t ZH
您好
# translate with line breaks removed
dptran -r "Hello
everyone!"
皆さん、こんにちは!
# translate from an editor (like vim, emacs. must be set in config)
dptran -e
# Editor will open
For more options and detailed usage, run:
dptran -h
usage : Show character usagelist : Show list of supported languages (-s for source languages, -t for target languages)glossary : Manage glossaries (create, delete, list, add/remove word pairs)config : General settings such as default target language and editor commandapi : API settings such as API keys and endpoint URLscache : Cache settings such as enabling/disabling cache, setting max entries, and clearing cachehelp : Print this message or the help of the given subcommand(s)Change default target language:
dptran config --target-lang JA
Reset all settings:
dptran config --clear-all
You can create and manage glossaries using the glossaries API to customize translations for specific words and phrases.
dptran glossary --create --name my_glossary
dptran glossary --name my_glossary --source-lang EN --target-lang FR --add-word-pairs "Hello" "Bonjour" "Goodbye" "Au revoir"
dptran glossary --list
-g option):dptran -f EN -t FR -g my_glossary Hello
dptran glossary --remove --name my_glossary
You can set the API endpoint URL using the api subcommand:
dptran api --endpoint-of-translation <ENDPOINT_OF_TRANSLATION>
dptran api --endpoint-of-usage <ENDPOINT_OF_USAGE>
dptran api --endpoint-of-langs <ENDPOINT_OF_LANGUAGES>
Then you can use dptran with your own API endpoint, e.g., a local LLM server.
Note that the API endpoints must be compatible with the DeepL API specification.
Run unit tests.
To run tests that require a real DeepL API key, set the environment variable DPTRAN_DEEPL_API_KEY:
export DPTRAN_DEEPL_API_KEY=[API key]
cargo test -- --test-threads=1
Some require dummy API server to be running.
The dummey server will be run at http://localhost:8000/ by default.
pip3 install -r requirements.txt
uvicorn dummy_api_server.main:app --reload
Crate page: https://crates.io/crates/dptran
Library docs: https://docs.rs/dptran
Licensed under either of:
v2.4.0 (2025-12-30)
dptran usage commandv2.3.4 (2025-10-04)
/quit, /help, /from, /to, etc.)v2.3.3 (2025-09-07)
do_translation()v2.3.2 (2025-07-07)
v2.3.1 (2025-07-01)
set subcommand into config, api, and cache subcommands