annotate bin/translatefromto @ 4923:c9619115046f

<oerjan> revert
author HackBot
date Mon, 29 Sep 2014 08:10:12 +0000
parents 7f957c1f4661
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e037173e0012 Initial import.
HackBot
parents:
diff changeset
1 #!/bin/bash
4531
7f957c1f4661 <oerjan> revert
HackBot
parents: 4530
diff changeset
2 echo "This google api no longer exists."; exit 1
0
e037173e0012 Initial import.
HackBot
parents:
diff changeset
3 TEXT="$1"
e037173e0012 Initial import.
HackBot
parents:
diff changeset
4 FROM=`echo "$TEXT" | sed 's/ .*$//'`
e037173e0012 Initial import.
HackBot
parents:
diff changeset
5 TEXT=`echo "$TEXT" | sed 's/^[^ ]* //'`
e037173e0012 Initial import.
HackBot
parents:
diff changeset
6 TO=`echo "$TEXT" | sed 's/ .*$//'`
e037173e0012 Initial import.
HackBot
parents:
diff changeset
7 TEXT=`echo "$TEXT" | sed 's/^[^ ]* //'`
e037173e0012 Initial import.
HackBot
parents:
diff changeset
8 if [ "$FROM" = "auto" ] ; then FROM="" ; fi
e037173e0012 Initial import.
HackBot
parents:
diff changeset
9
e037173e0012 Initial import.
HackBot
parents:
diff changeset
10 curl -e http://codu.org/ http://ajax.googleapis.com/ajax/services/language/translate \
e037173e0012 Initial import.
HackBot
parents:
diff changeset
11 --data-urlencode v=1.0 \
e037173e0012 Initial import.
HackBot
parents:
diff changeset
12 --data-urlencode q="$TEXT" \
e037173e0012 Initial import.
HackBot
parents:
diff changeset
13 --data-urlencode langpair="$FROM"'|'"$TO" 2> /dev/null |
e037173e0012 Initial import.
HackBot
parents:
diff changeset
14 json 'data["responseData"]["translatedText"]'