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
Читайте також:
- Current Git and SVN Branch in Bash Prompt
- BASH key bindings
- Bash Completion on Mac OS X
- How To capture video from tv-tuner card via mencoder
- Shell script to convert .flac files to .mp3 format
- kerl - easy building and installing of Erlang/OTP instances
- bash history - відображення дати і часу для кожної команди
- Django yandex and google maps integration
- Goo.gl URL shortener
- Відкриті DNS сервера від google