on *:sockopen:lang:{
; echo -s GET /tr?doit=done&tt=urltext $+ lp= $+ $hget(lang,lang) $+ &urltext= $+ $hget(lang,translate) $+ &url=http%3A%2F%2F HTTP/1.0
sockwrite -n $sockname GET /tr?doit=done&tt=urltext $+ lp= $+ $hget(lang,lang) $+ &urltext= $+ $hget(lang,translate) $+ &url=http%3A%2F%2F HTTP/1.0
sockwrite -n $sockname Host: world.altavista.com
sockwrite -n $sockname Connection: close
sockwrite -n $sockname $crlf
}
on *:sockread:lang:{
sockread -f %x
; echo -s %x
tokenize 32 %x
if (<form action="http://www.altavista.com/web/results" method=get> == $1-) { hadd lang response $true | return }
if (($hget(lang,response)) || (<td bgcolor=white* iswm $1-)) {
echo -a $1-
echo -a Translation from $replace($hget(lang,language),/,$chr(32) $+ to $+ $chr(32)) $+ :
echo -a $gettok($hget(lang,language),1,47) $+ : $replace($hget(lang,translate),+,$chr(32))
echo -a $gettok($hget(lang,language),2,47) $+ : $gettok($1-,2-,62)
hdel lang response
}
unset %x
}
alias lang { if (!$2) { echo $colour(Info) -a * /lang: insufficient parameters | return }
if ($sock(lang)) sockclose lang
if ($hget(lang)) { hfree lang }
hmake lang 10
hadd lang translate $replace($2-,$chr(32),+)
hadd lang language $1
var %' = English/Chinese:en_zh English/French:en_fr English/German:en_de English/Italian:en_it English/Japanese:en_ja English/Korean:en_ko English/Portuguese:en_pt English/Spanish:en_es Chinese/English:zh_en French/English:fr_en French/German:fr_de German/English:de_en German/French:de_fr Italian/English:it_en Japanese/English:ja_en Korean/English:ko_en Portuguese/English:pt_en Russian/English:ru_en Spanish/English:es_en, %" = 1, %"'
while ($gettok(%',%",32)) {
if ($1 == $gettok($ifmatch,1,58)) { hadd lang lang $gettok($gettok(%',%",32),2,58) }
%"' = %"' $gettok($gettok(%',%",32),1,58)
inc %"
}
if (!$hget(lang,lang)) { echo $colour(Info) -a * /lang: invalid language, please use; %"' | return }
sockopen lang world.altavista.com 80
}
;DOCUMENTATION
;and other little crap
;use /lang <lang1/lang2> <text>
;if you make an invalid language like /lang whatever then it will show you all the languages you can have
;use how u wish, translations provided from altavista.com (babel fish)
;nonexistant