-
;en = English,sp[es] = Spanish,fr = French,ge[de] = German,it = Italian,por[pt] = Portuguese
-
on $*:TEXT:$(/^(?>\Q $+ $me $+ \E,? ?)?([!.@](trans(late)?|lang(uage)?)).*/Si):#:{
-
tokenize 32 $iif($me isin $1,$deltok($1-,1,32),$1-)
-
if (($me != Plasma) && ($read(onebot.txt, s, $chan))) { halt }
-
if (!$2) {
-
notice $nick $c1(Please select a correct language to translate to and from. Currently Supports:) $c2(en = English) $c1($chr(124)) $c2(sp = Spanish) $c1($chr(124)) $c2(fr = French) $c1($chr(124)) $c2(ge = German) $c1($chr(124)) $c2(it = Italian) $c1($chr(124)) $c2(por = Portuguese) $c1(Example:) $c2(!translate en-sp Hello) $c1(Remember the languages must be different!)
-
halt
-
}
-
if (!$3) {
-
notice $nick $c1(Please select a correct language to translate to and from. Currently Supports:) $c2(en = English) $c1($chr(124)) $c2(sp = Spanish) $c1($chr(124)) $c2(fr = French) $c1($chr(124)) $c2(ge = German) $c1($chr(124)) $c2(it = Italian) $c1($chr(124)) $c2(por = Portuguese) $c1(Example:) $c2(!translate en-sp Hello) $c1(Remember the languages must be different!)
-
halt
-
}
-
if (!$lang($gettok($2,1,45),$gettok($2,2,45))) {
-
notice $nick $c1(Please select a correct language to translate to and from. Currently Supports:) $c2(en = English) $c1($chr(124)) $c2(sp = Spanish) $c1($chr(124)) $c2(fr = French) $c1($chr(124)) $c2(ge = German) $c1($chr(124)) $c2(it = Italian) $c1($chr(124)) $c2(por = Portuguese) $c1(Example:) $c2(!translate en-sp Hello) $c1(Remember the languages must be different!)
-
halt
-
}
-
else {
-
/inc %Aa
-
/set $+(%,langtext,%Aa) $replace($3-,$chr(32),+)
-
/set $+(%,lang,%Aa) $replace($2,$chr(45),$chr(124),eng,en,sp,es,ger,de,ge,de,por,pt)
-
if ($readini(public_cmds.ini,Channels,$chan) == off) {
-
/set $+(%,langtarget,%Aa) $iif($left($1,1) == @,notice $nick,.notice $nick)
-
}
-
else {
-
/set $+(%,langtarget,%Aa) $iif($left($1,1) == @,msg $chan,.notice $nick)
-
}
-
/sockopen $+(lang.,%Aa) translate.google.com 80
-
}
-
}
-
on *:SOCKOPEN:lang.*:{
-
/sockwrite -n $sockname GET /translate_t?text= $+ $($+(%,langtext,$gettok($sockname,2,46)),2) $+ &langpair= $+ $($+(%,lang,$gettok($sockname,2,46)),2) HTTP/1.1
-
/sockwrite -n $sockname Host: translate.google.com $+ $crlf $+ $crlf
-
}
-
on *:SOCKREAD:lang.*:{
-
/sockread &var
-
/bwrite test.txt 1 -1 &var
-
/set $+(%,langstart,$gettok($sockname,2,46)) $bfind(&var,1,)/set $+(%,langend,$gettok($sockname,2,46)) $bfind(&var,$($+(%,langstart,$gettok($sockname,2,46)),2),)
-
/set $+(%,langoutput,$gettok($sockname,2,46)) $bvar(&var,$($+(%,langstart,$gettok($sockname,2,46)),2),$calc($($+(%,langend,$gettok($sockname,2,46)),2) - $($+(%,langstart,$gettok($sockname,2,46)),2))).text
-
$($+(%,langtarget,$gettok($sockname,2,46)),2) $c1(The translation for:) $c2($replace($($+(%,langtext,$gettok($sockname,2,46)),2),+,$chr(32))) $c1(from) $c2($replace($gettok($($+(%,lang,$gettok($sockname,2,46)),2),1,124),en,English,es,Spanish,fr,French,de,German,it,Italian,pt,Portuguese)) $c1(to) $c2($replace($gettok($($+(%,lang,$gettok($sockname,2,46)),2),2,124),en,English,es,Spanish,fr,French,de,German,it,Italian,pt,Portuguese)) $c1(is:) $c2($remove($($+(%,langoutput,$gettok($sockname,2,46)),2),))/unset $+(%,lang*,$gettok($sockname,2,46))halt}alias lang {if (($regex($1,/(eng|en|es|sp|fr|de|ge|ger|it|por|pt)$/Si)) && ($regex($2,/(eng|en|es|sp|fr|de|ge|ger|it|por|pt)$/Si)) && ($replace($1,eng,en,sp,es,ger,de,ge,de,por,pt) != $replace($2,eng,en,sp,es,ger,de,ge,de,por,pt))) {return true}}
Posted by Anonymous Fri 23rd Feb 2007 23:43 - Syntax is None/text - 71 views
Download | New Post | Modify | Hide line numbers
Download | New Post | Modify | Hide line numbers
PermaLink to this entry https://pastebin.co.uk/10857
Posted by Anonymous Fri 23rd Feb 2007 23:43 - Syntax is None/text - 71 views
Download | New Post | Modify | Hide line numbers
Download | New Post | Modify | Hide line numbers
Comments: 0