#!/bin/csh -f # translate # ----------------------------------------------------------------------------- # C shell script to translate a word or phrase from human language to another # ----------------------------------------------------------------------------- # Usage: Run with -h or --help to see usage. # Assumptions: # Effects: # - None # Notes: # Implementation Notes: # Portability Issues: # Revision History: # $Log$ # ----------------------------------------------------------------------------- if ($#argv == 0 || "$1" == "-h" || "$1" == "--help") then echo "Usage:" echo " $0:t [word or phrase to translate]" echo "Examples:" echo " $0:t" echo " $0:t cogito ergo sum" exit 1 endif set browser = "open" # If $1 is a script in the browsers folder, use it as the browser. if ($#argv > 0 && -x "$0:h/browsers/$1") then set browser = $1:q shift endif if ($#argv == 0) then #open http://babelfish.yahoo.com/ (set echo; $browser open http://translate.google.com/) else echo "Translating $*:q..." # op=translate = Action to take. Are there others? # sl=auto = Autodetect source language # tl=en = Use English as target language (set echo; $browser "https://translate.google.com/?op=translate&sl=auto&tl=en&text=$1:q+$2:q+$3:q+$4:q+$5:q+$6:q+$7:q+$8:q+$9:q+$10:q+$11:q+$12:q+$13:q+$14:q+$15:q+$16:q+$17:q+$18:q+$19:q+$20:q") # Old way that stopped working # open "http://translate.google.com/#auto/en/$*" endif