view bin/translatefromto @ 12500:e48c08805365 draft default tip

<b_jonas> ` learn \'The password of the month is Cthulhuquagdonic Mothraquagdonic Narwhalicorn.\' # https://logs.esolangs.org/libera-esolangs/2024-04.html#lKE Infinite craft
author HackEso <hackeso@esolangs.org>
date Wed, 01 May 2024 06:39:10 +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"]'