$ dptran

Translate on your command line.
A tool to run DeepL translations on your command line.
It's written in Rust, and uses curl to connect to the DeepL API.
To use, you need to get the DeepL API key from https://www.deepl.com/en/pro-api/.

Install Now!

Available on crates.io.
Latest version: v
$ cargo install dptran
Features
dptran provides a command-line tool to translate text using the DeepL API.
  • Translate text from the command line arguments.
  • Translate text interactively.
  • Translate multiple lines.
  • Translate text from the pipeline.
  • Translate text from a file. (v.2.1.0-)
  • Translate text from an editor. (v.2.1.0-)
  • Remove line breaks from the source text. (v.2.1.0-)
  • Output to a text file. (v.2.1.0-)
  • Check the number of characters remaining to be translated.
  • Check valid language codes.
  • Cache the translation results. (v.2.1.0-)
Use as a command-line tool (binary crate)
Translate from the command line arguments
If any language is not specified, the source language is automatically detected.
And the destination language is set to English (EN-US; by default).
$ dptran Bonjour
Hello

To specify the source language, use the -f option followed by the language code.
$ dptran -f DE Hallo
Hello

To specify the destination language, use the -t option followed by the language code.
$ dptran -t FR Hello
Bonjour
Translate in interactive mode
Multiple source texts can be translated interactively. Exit with quit.
If you want to translate the source texts into a specific language, use the -t option.
$ dptran -t EN
> ありがとうございます。
Thank you very much.
> Ich stehe jeden Tag um 7 Uhr auf.
I get up at 7 a.m. every day.
> quit
Translate from the pipeline
dptran can translate the output of other commands with dptran.

e.g. Translate the content of the man page into Japanese (JA).
$ man ls | cat | dptran -t JA
Translate from a file
dptran can translate the contents of a text file with dptran by using the -i option.
$ dptran -i file.txt
...And more features!
See the README.md for more information.
Use as a library
dptran can be used as a library in your Rust project.
dptran includes the binary crate's dependent crates (such as clap, serde_json and confy) by the default features.

To install only the library crate, please disable the default features by adding --no-default-features argument.
$ cargo add dptran --no-default-features

Or, add this to your Cargo.toml:
[dependencies]

For more information about the library, see the documentation.
License
dptran is licensed under the MIT or Apache-2.0 license.
Releases
Version Release date Install
ver.2.1.0 July 14, 2024
$ cargo install dptran@=2.1.0
ver.2.0.0 March 3, 2024
$ cargo install dptran@=2.0.0
ver.1.0.2 December 1, 2023
$ cargo install dptran@=1.0.2
ver.1.0.1 December 1, 2023
$ cargo install dptran@=1.0.1
ver.1.0.0 December 1, 2023
$ cargo install dptran@=1.0.0