Translate texts by using the Ubuntu command shell

Read this article in english Diesen Artikel auf Deutsch lesen

Surfing round the world wide web, taking advantage of the high waves, we found a script (which we had to modify a little) that seems very useful to us. It's a script that can be used to translate texts in the command shell, to accomplish this, it queries to a Google API which translates the text, and than it changes the appearence of the text, to be able to show it to the user.

First thing we need to do, is to install the dependencies, by executing the following line in a command shell:

sudo apt-get install lynx

Now we'll need to download the script and allow the execution by executing the following lines:

  1. wget "http://ubuntu-blog.com/compartidos/translate"
  2. sudo mv translate /usr/local/bin/
  3. sudo chmod +x /usr/local/bin/translate

Now we'll have the script ready to use.

To translate a text in Ubuntu you'll now have to use the following syntax:

translate [text language] [desired language] [text]

For example executing the following line:

translate es en "Voy a visitar ubuntu-blog todos los días"

The command shell will answer: "I'm going to visit ubuntu-blog every day"

Leave a comment

Name: (Required)

eMail: (Required)

Website:

Comment: