annotate bin/translatefromto @ 3294:5431aaeefaf7

<elliott> addquote <kmc> Bike: i think it\'s a fermented fish product? <kmc> either that or it means "welcome" in finnish
author HackBot
date Wed, 10 Jul 2013 02:44:44 +0000
parents e037173e0012
children 30212f437ffe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e037173e0012 Initial import.
HackBot
parents:
diff changeset
1 #!/bin/bash
e037173e0012 Initial import.
HackBot
parents:
diff changeset
2 TEXT="$1"
e037173e0012 Initial import.
HackBot
parents:
diff changeset
3 FROM=`echo "$TEXT" | sed 's/ .*$//'`
e037173e0012 Initial import.
HackBot
parents:
diff changeset
4 TEXT=`echo "$TEXT" | sed 's/^[^ ]* //'`
e037173e0012 Initial import.
HackBot
parents:
diff changeset
5 TO=`echo "$TEXT" | sed 's/ .*$//'`
e037173e0012 Initial import.
HackBot
parents:
diff changeset
6 TEXT=`echo "$TEXT" | sed 's/^[^ ]* //'`
e037173e0012 Initial import.
HackBot
parents:
diff changeset
7 if [ "$FROM" = "auto" ] ; then FROM="" ; fi
e037173e0012 Initial import.
HackBot
parents:
diff changeset
8
e037173e0012 Initial import.
HackBot
parents:
diff changeset
9 curl -e http://codu.org/ http://ajax.googleapis.com/ajax/services/language/translate \
e037173e0012 Initial import.
HackBot
parents:
diff changeset
10 --data-urlencode v=1.0 \
e037173e0012 Initial import.
HackBot
parents:
diff changeset
11 --data-urlencode q="$TEXT" \
e037173e0012 Initial import.
HackBot
parents:
diff changeset
12 --data-urlencode langpair="$FROM"'|'"$TO" 2> /dev/null |
e037173e0012 Initial import.
HackBot
parents:
diff changeset
13 json 'data["responseData"]["translatedText"]'