The importance of Language translation applications cannot be overemphasized especially for those who travel a lot or communicate with people who don’t share the same language on a regular basis.
Today, I introduce to you the best command-line based translation tools for Linux.
1. DeepL Translator CLI
DeepL Translator Cli is a free and open source command line language translator that uses advanced machine learning techniques to enable users to translate text between languages as well as to detect the language of the input text. It is powered by DeepL, a German tech company and released under the MIT license.
The languages it supports include English (EN), German (DE), French (FR), Italian (IT), Dutch (NL), Spanish (ES), Russian, Portuguese, and Polish (PL) and while the terminal tool is free, DeepL offers subscription plans for interested users.
Install DeepL Translator CLI in Linux
To install DeepL Translator command-line tool, first you need to install the latest version of Node.js in your Linux distribution.
Next, install Yarn package dependency manager using Debian package repository on Debian and Ubuntu distribution using following commands.
$ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - $ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list $ sudo apt-get update $ sudo apt-get install yarn
On CentOS, Fedora and RHEL distribution, you can install Yarn via RPM package repository.
# curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo # yum install yarn [On CentOS/RHEL] # dnf install yarn [On Fedora]
Now install DeepL Translator command-line tool using the following command.
$ yarn global add deepl-translator-cli
Verify the installation status by checking DeepL version.
$ deepl --version
DeepL works by making API calls to the main website at deepl.com so, at the moment, you need to be online to use it. It reportedly runs on a supercomputer capable of 5.1 petaFLOPS – enough speed to detect and translate languages in a blink.
DeepL Usage Examples
# Translate text into German $ deepl translate -t 'DE' 'How do you do?' # Pipe text from standard input $ echo 'How do you do?' | deepl translate -t 'DE' # Detect language $ deepl detect 'Wie geht es Ihnen?' # For help $ deepl -h $ deepl translate -h $ deepl detect -h
2. Translate Shell
Translate Shell (previously Google Translate CLI) is a free and open source command-line language translator tool powered by Google Translate, Yandex Translate, Apertium, and Bing Translator. It is available for most POSIX-compliant systems including Windows (via Cygwin, WSL, or MSYS2), GNU/Linux, macOS, and BSD.
Translate Shell allows users to use it for simple translations or as an interactive shell. For simple translations, Translate Shell gives details of the translated text by default unless when made to do exclude the details using the keyword, brief.
$ trans 'Saluton, Mondo!' Saluton, Mondo! Hello, World! Translations of Saluton, Mondo! [ Esperanto -> English ] Saluton , Hello, Mondo ! World!
$ trans -brief 'Saluton, Mondo!' Hello, World!
When used as an interactive shell, it will translate the texts as you enter them line by line. For example,
$ trans -shell -brief > Rien ne réussit comme le succès. Nothing succeeds like success. > Was mich nicht umbringt, macht mich stärker. What does not kill me makes me stronger. > Юмор есть остроумие глубокого чувства. Humor has a deep sense of wit. > 幸福になるためには、人から愛されるのが一番の近道。 In order to be happy, the best way is to be loved by people.
Install Translate Shell in Linux
My recommended download method is for you to grab the self-contained executable file from here, place it in your path, and run the following commands:
$ wget git.io/trans $ chmod +x ./trans
For more details on installation and usage check its official GitHub page here.
Do you know other awesome command line text translator apps for Linux? Add your suggestions in the comments section below.
Help: deepl-translate(1) does not exist, try
--help
.Have you installed DeepL?
Run “
deepl --version
” and if the version displays, run “deepl --help
“.Based on this issue (https://github.com/vsetka/deepl-translator-cli/issues/3), seems like the problem is on *command* module. Still waiting for the fix.