/usr/lib/surfraw/translate is in surfraw 2.2.9-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | #!/bin/sh
# $Id$
# elvis: translate -- Translate human languages
. surfraw || exit 1
w3_config_hook () {
def SURFRAW_translate_from "$SURFRAW_lang"
def SURFRAW_translate_to "$SURFRAW_lang"
}
w3_usage_hook () {
cat <<EOF
Usage: $w3_argv0 [options] [words|URI]...
Description:
Surfraw translate human language
Local options:
-from=LANGUAGE Source language
Environment: SURFRAW_translate_from, SURFRAW_lang
-to=LANGUAGE Destination language
Environment: SURFRAW_translate_to, SURFRAW_lang
Languages (any provider):
nl Dutch
en English
fr French
de German
el Greek
it Italian
ja Japanese
ko Korean
pt Portuguese
ru Russian
es Spanish
Languages (Systrans only):
zh Chinese (Simplified)
zt Chinese (Traditional)
Languages (Google only):
auto Automatically detect language
af Afrikaans
sq Albanian
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bg Bulgarian
ca Catalan
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
hr Croatian
cs Czech
da Danish
et Estonian
tl Filipino
fi Finnish
gl Galician
ka Georgian
ht Hatian Creole
iw Hebrew
hi Hindi
hu Hungarian
is Icelandic
id Indonesian
ga Irish
la Latin
lv Latvian
lt Lithuanian
mk Macedonian
ms Malay
mt Maltese
no Norwegian
fa Persian
pl Polish
ro Romanian
sr Serbian
sk Slovak
sl Slovenian
sw Swahili
sv Swedish
th Thai
tr Turkish
uk Ukrainian
ur Urdu
vi Vietnamese
cy Welsh
yi Yiddish
Examples:
$w3_argv0 Provider's standard translation page
$w3_argv0 -from=fr -to=en la verite vous liberera
$w3_argv0 -from=en -to=es http://tashian.com/multibabel
Translate the given Web page
Bugs:
Systrans derived providers only support the following translation
combinations:
English to Chinese
English to French
English to German
English to Italian
English to Japanese
English to Korean
English to Portuguese
English to Spanish
Chinese to English
French to English
French to German
German to English
German to French
Italian to English
Japanese to English
Korean to English
Portuguese to English
Russian to English
Spanish to English
EOF
w3_global_usage
}
w3_parse_option_hook () {
opt="$1"
optarg="$2"
case "$opt" in
-from=*) setopt SURFRAW_translate_from $optarg ;;
-to=*) setopt SURFRAW_translate_to $optarg ;;
*) return 1 ;;
esac
return 0
}
w3_config
w3_parse_args "$@"
# w3_args now contains a list of arguments
if test -z "$w3_args"
then w3_browse_url "http://translate.google.com/"
else
if [ -z "$SURFRAW_translate_to" ];
then
SURFRAW_translate_to="en"
fi
if [ -z "$SURFRAW_translate_from" ];
then
SURFRAW_translate_from="fr"
fi
escaped_args=`w3_url_of_arg $w3_args`
case "$escaped_args" in
http*) w3_browse_url "http://translate.google.com/translate?&sl=${SURFRAW_translate_from}&tl=${SURFRAW_translate_to}&u=${escaped_args}"
;;
*) w3_browse_url "http://translate.google.com/?&sl=${SURFRAW_translate_from}&tl=${SURFRAW_translate_to}&q=${escaped_args}"
;;
esac
fi
exit $?
|