Google Translate API From The Command Line
Simple wrapper for google translate api
#!/bin/bash
if [ $# == 3 ]
then
echo "From: $1 To: $2"
lynx -dump "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=$3&langpair=$1|$2"|awk -F'"' '{print $6}'
else
lynx -dump "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=$1&langpair=|ar"|awk -F'"' '{print "From: "$10" To: ar \n"$6}';echo
lynx -dump "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=$1&langpair=|en"|awk -F'"' '{print "From: "$10" To: en \n"$6}';echo
fi
Example:
$ ./gtranslate.sh ru en "тест"
From: ru To: en
test
Читайте також:
- Bash Completion on Mac OS X
- bash history - відображення дати і часу для кожної команди
- How To capture video from tv-tuner card via mencoder
- BASH key bindings
- kerl - easy building and installing of Erlang/OTP instances
- Current Git and SVN Branch in Bash Prompt
- Shell script to convert .flac files to .mp3 format
- Django yandex and google maps integration
- Реклама від Google
- Goo.gl URL shortener