justapeon Posted August 25, 2011 Posted August 25, 2011 (edited) Think it is neat that we can use the world of computers to translate languages even from the command line. Opens up a whole new world without ever leaving your computer. This what we did. $ sudo apt-get update $ sudo apt-get install wget Translating words from the command line: (for example from italian to english. $ ./lc.sh “Ti voglio molto bene” it en Love you very much $ $ ./lc.sh “Ti voglio molto bene” it zh 非常爱你 $ lc.sh #!/bin/bash if test -z $3; then echo "Usage: $0 \"<str>\" <lang1> <lang2>" echo "Translates string \"<str>\" from <lang1> to <lang2>" echo "(CLI frontend to Google Translate)" else wget -qO- "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=$1&langpair=$2|${3:-$3}" | sed 's/.*"translatedText":"\([^"]*\)".*}/\1\n/'; fi echo "" Edited August 25, 2011 by justapeon Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.