How to use Google Translate from terminal

Google Translate Command-line

Google Translate is the one-stop service that most of us use for text or url translation. How cool is that if we can use in the terminal? Thanks to Translate Shell, which is a command-line utility which can help you to translate any text from your shell. Translate Shell is compatible with GNU/Linux, OS X (MacOS from now on), FreeBSD and even Windows (via Cygwin or MSYS2).

Translate IO download

Installation:

 wget git.io/trans
chmod +x ./trans
sudo mv ./trans /usr/bin/

Note: In OS X if you encounter Operation Not Permitted error then please follow my previous article How to fix El Capitan 10.11 Operation Not Permitted error.

Basic Usage examples:

Help:

 trans -H 

Show available languages:

 trans -R 

Google Translate Languages List

 trans お元気ですか 

Translate Shell uses your locale as your target language if you haven’t provided one as input. Setting UTF-8 codeset as your default locale is advisable as it supports multiple-languages. You can check your default locale using the following command,

 locale 

check-locale-osx
Translate in brief:

 trans -b お元気ですか? 

translate-brief

Translate briefly and Interactively:

 trans -b -I 

and follow the prompt

Google interactive translation

Translate into a specific language:

 trans :ja How are you? 

translate-without-default

Translate into multiple languages:

 trans :ta+ja How are you? 

Google translate in to multiple languages

Translate by providing input and output languages:

 trans ja:en お元気ですか? 

Google translate japanese to english

For advance usage, please read the github readme instructions.

Leave a Comment

Your email address will not be published. Required fields are marked *