Google Translate, CLI version

Since the Google Translate API is not free, and since
I like to work on the command line as much as I can, here’s
what I concocted yesterday. It’s a crude shell script, but it
works. Basically it asks for the word you want translated and
it delivers the translation. Feel free to improve, as it could
be cooler if it would ask the source and the destination language,
but it Works for me (TM). Make sure you have lynx installed.

#!/bin/sh
printf "Enter the word you like translated:\n"
read word
lynx -dump http://translate.google.com/\?hl=en\&sl=en\&tl=ro\&q="$word"\
 | sed -n '29p'

Change sl (source language) and tl (translated language) according
to your needs.

One thought on “Google Translate, CLI version

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s