annotate bin/translatefromto @ 4015:2c73cd5439ac

<mrhmouse> echo "echo \'ewww\'" >> bin/buttsnack
author HackBot
date Wed, 13 Nov 2013 21:38:02 +0000
parents 30212f437ffe
children 03afb1619ef2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e037173e0012 Initial import.
HackBot
parents:
diff changeset
1 #!/bin/bash
3844
30212f437ffe <oerjan> sed -i \'1aecho "This google api no longer exists."; exit 1\' bin/translatefromto
HackBot
parents: 0
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"]'