Translate Shell is a free and open source command-line translator tool for Linux, macOS, BSD, Android and Windows. It uses Google Translate, Bing Translator, Yandex Translate, and Apertium engines to translate your queries. This tool formerly known as Google Translate CLI but now it uses four different sources to get result. The default is Google Translate but you can switch easily to other provides. It is very good tool for non-native English speaker command line users. By default, this tool translate the given words to English.
Install Translate Shell on Ubuntu
You can install Translate Shell command-line Translator Tool via the default Ubuntu package manager or via the direct download.
Ubuntu Package Manage:
Open the terminal (ctrl+alt+t) app and run these commands. Enter your ubuntu user password if needed.
sudo apt update
sudo apt install translate-shell
Direct Download:
You can also install it from the self-contained executable file and make it as executable.
wget git.io/trans
chmod +x ./trans
sudo mv trans /usr/local/bin/
Then move it to your $PATH.
Google Translate From Command line:
In your terminal run this command to find the language codes.
trans -R
This will help you to translate from one source language to other target language.
Below you will see some examples:
Note: by default, translate shell will translate any language to english.
Translate Spanish to English
trans Hola
You will get output like below.
For the whole sentence, put inside the quote.
trans "Hola como estas"
Translate content from file:
trans file:///home/manikandan/hello.txt
Translate to other than English:
You can specify the target language by -t
English to Dutch
trans -t nl Hello
English to Dutch, Czech & Greek
trans -t nl+cs+el Hello
Translate from a specific language
You can also specify the source language by the -s
trans -s es Hola
Translate a website
below command will translate a english website to spanish
trans -t es https://connectwww.com/
click the link in your terminal.
You can also identify the language, if you don’t know the language.
trans -id Hola
For the complete Translate shell usage details run this command.
trans -M