summaryrefslogtreecommitdiffstats
path: root/util/bin/translate.google
blob: 2418dc378dca4abf03b7c1732f607e852acb46aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#! /bin/sh
set -euf

sl=${SL:="auto"}
tl=${TL:="en"}

text=$*

url="http://translate.google.com/translate_a/t?client=t&sl=$sl&tl=$tl"

curl -A "Mozilla/5.0" -Ss "$url" --data-urlencode "text=$text" |
  sed 's/\[\[\[\"//' |
  cut -d \" -f 1