view bin/translatefromto @ 12229:9e87b11251e2 draft

<oerjan> le/rn scowrevs///hackenv/share/scowrevs is a list of repository revision ranges that affected a lot of files but in the end changed nothing (usually because of a revert at the end). Most of our custom repository lookup commands ignore these to reduce noise.
author HackEso <hackeso@esolangs.org>
date Wed, 04 Dec 2019 06:18:32 +0000
parents 56dcce63901b
children
line wrap: on
line source

#!/bin/bash
echo "This google api no longer exists."; exit 1
TEXT="$1"
FROM=`echo "$TEXT" | sed 's/ .*$//'`
TEXT=`echo "$TEXT" | sed 's/^[^ ]* //'`
TO=`echo "$TEXT" | sed 's/ .*$//'`
TEXT=`echo "$TEXT" | sed 's/^[^ ]* //'`
if [ "$FROM" = "auto" ] ; then FROM="" ; fi

curl -e http://codu.org/ http://ajax.googleapis.com/ajax/services/language/translate \
         --data-urlencode v=1.0 \
         --data-urlencode q="$TEXT" \
         --data-urlencode langpair="$FROM"'|'"$TO" 2> /dev/null |
         json 'data["responseData"]["translatedText"]'