Translate-shell, translate to any language from the command line

About Translate-shell

In the next article we are going to take a look at Translate-shell (formerly Google Translate CLI). This is a translator for command line that provides us with different translators such as Google Translate (default), Bing Translator, Yandex.Translate, DeepL Translator, and Apertium. This program will give us easy access to each of these translation engines from our terminal.

Over the time on this blog, other colleagues like myself have written many articles about the CLI applications. Today we are going to talk about how to use “Google Translate"In the terminal of our Ubuntu. I use these tools many times throughout the day to know the meanings of many concepts, since despite managing a bit with English, on many occasions I have found myself diving in German, French or sometimes Asian forums, where it is not always written in English or another language in which I defend myself correctly.

What is Translate-shell?

translate-shell (formerly known as Google Translate CLI) is a command line translator via Google Translate (default), Bing Translator, Yandex.Translate, and Apertium. It will allow us to access one of these translation engines directly from your terminal. Translate-shell is designed to work on most Gnu / Linux distributions.

How to install Translate-shell

We can install the Translate Shell application on our Ubuntu using either of the following two methods. There is a third installation method, but I have not tried it, so I do not add it to the article.

  • Manual method (Recommended)
  • Via Package Manager

Method 1: Manual method (Recommended)

With this method we will only have to clone Translate-shell repository. We can find this on GitHub and compile it manually for any distribution. We will have to open a terminal (Ctrl + Alt + T) and write each of the commands shown below:

git clone https://github.com/soimort/translate-shell && cd translate-shell
make
sudo make install

Method 2: Through Package Manager

Translate-shell is available in some of the official repositories of the most popular distributions. We can install it through the package manager. To perform the installation on Debian / Ubuntu, we will only need to use the APT-GET or APT command. We will only have to open a terminal (Ctrl + Alt + T) and write:

sudo apt-get install translate-shell

How to use Translate-Shell

After successfully performing any of the possible installations, we can open the terminal and launch the program using the following command format. This tool can identify the language of the source text automatically. By default it translates the original text into English.

trans [palabras]

Translated into English

I will translate "healthy" to English. For this we will only have to write in the terminal (Ctrl + Alt + T):

saúdos trans

trans saúdos

Select the language to translate to

We can translate a word (in this case the same as in the previous example) to German (e.g.) using the following command:

trans from saúdos

trans :de saúdos

Translate to more than one language

To translate a word into more than one language, we will be able to use the following command (In this example, I am going to translate the word saúdos to Tamil and Hindi):

trans ta + hi saúdos

trans :ta+hi saúdos

Translate entire sentences

To translate a phrase, simply use the sentence in quotes as you can see below. The following example will translate from English to Spanish:

trans translate phrase is

trans :es "what is going on your life?"

See simple translation

Translate-shell shows translations in detail by default. If you prefer to see only the information in simple mode, you just have to add the -b option in command.

trans b simple mode

trans -b :es thanks

Translate in dictionary mode

Dictionary mode. To use this tool as a dictionary, simply add -d option to command:

trans d dictionary mode

trans -d :es thanks

Translate a file

To translate a file we will need to indicate the path of the file to be translated. Use the following format in the terminal (Ctrl + Alt + T):

trans translation file

trans :es file:///home/sapoclay/gtrans.txt

Use interactive mode

To open the interactive Translate-shell we will have to make sure we have to specify the source language and the target language before starting an interactive shell. In this example, I am going to translate the word thanks from English to Spanish.

trans -shell en:es thanks

Get the codes of the available languages

To find out the language codes that we can use, simply run the following command:

trans languages ​​available

trans -T

Help

To know more options we can use the help man:

man trans

We can also learn more about this tool in the GitHub page of the project.


A comment, leave yours

Leave a Comment

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

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   zero said

    Thank you!

    it was just what i needed

    fortune| trans -b :es | xcowsay –image=”insert your favorite image”