mIRC Google Translate

kullanımı
/cevir # en-tr yes yazarsanız evet döner
/cevir # tr-en evet yazarsanız yes döner
aynı mantık diğer dillerdede geçerli örneğin almancada
/cevir # de-tr Salut yazarsanız selam döner
/cevir # tr-de selam yazarsanız Salut döner
kanal kullanıcıları için
!cevir en-tr yes yazarsanız evet döner
!cevir tr-en evet yazarsanız yes döner
aynı mantık diğer dillerdede geçerli örneğin almancada
!cevir de-tr Salut yazarsanız selam döner
!cevir tr-de selam yazarsanız Salut döner


#TransTrigger on
On $*:Text:/^(!|@)cevir.*/Si:#: {
if ($timer($+(Gtrans,$network,$nick))) { return }
.timer $+ $+(Gtrans,$network,$nick) 1 4 noop
var %method $iif($regml(1) == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%)/),.msg $chan,.notice $nick))
if (help isin $1) { TransHelp %method | return }
if (!$3) { %method No text to Translate | TransHelp %method | return }
if (!$regex($left($2,3),/-|_/)) { %method $2- is unknown to me. | TransHelp %method | return }
if (!$regex($left($2,2),/en|fr|nl|de|pt|it|es|sq|et|ca|hr|cs|da|et|tl|fi|gl|hu|id|lv|lt|mt|no|pl|ro|sk|sl|sv|tr/i)) {
%method $2- is unknown to me.
TransHelp %method
return
}
if (!$regex($right($2,2),/en|fr|nl|de|pt|it|es|sq|et|ca|hr|cs|da|et|tl|fi|gl|hu|id|lv|lt|mt|no|pl|ro|sk|sl|sv|tr/i)) {
%method $2- is unknown to me.
TransHelp %method
return
}
cevir %method $2 $strip($3-)
}
#TransTrigger end
alias -l TransHelp {
$1-2 Syntax: !cevir L1-L2 Text to translate. L1 = the language you are typing in. L2 = The language you want to translate to.
$1-2 Valid languages: en,fr,nl,de,pt,it,es,sq,et,ca,hr,cs,da,et,tl,fi,gl,hu,id,lv,lt,mt,no,pl,ro,sk,sl,sv,tr $&
For a code explanation look here -->> Google Translate API v1 JavaScript Reference - Google Translate API v1 - Google Code
}
alias -l cevir {
var %sockname $+(GTrans,$network,$2,$ticks)
sockopen %sockname translate.google.com 80
sockmark %sockname $1-2 $+(/translate_t?langpair=,$lower($replace($3,-,|,_,|)),&text=,$fixurl($4-),#)
}
on *:sockopen:GTrans*: {
if (!$sockerr) {
sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) /1.0
sockwrite -n $sockname Host: translate.google.com $+ $str($CRLF,2)
}
else { echo -st socket error $nopath($script) | sockclose $sockname | return }
}
on *:sockread:GTrans*: {
if ($sockerr) { echo -st socket error $nopath($script) | sockclose $sockname | return }
else {
sockread -fn &transvar
;echo -a $bvar(&transvar,1,$bvar(&transvar,0)).text
if ($bintween(&transvar,onmouseout="this.style.backgroundColor='#fff'">,,1)) {
$gettok($sock($sockname).mark,1-2,32) $fixhtml($v1)
}
}
}
alias -l bintween {
var %count = 1, %mark = 0, %mark2 = 0
while (%count < = $4) { if ($bfind($1, %mark2, $2).text) { %mark = $calc($bfind($1, %mark2, $2).text + $len($2)) if ($bfind($1, %mark, $3).text) { %mark2 = $bfind($1, %mark, $3).text } else { return 0 } } else { return 0 } inc %count } return $bvar($1, $iif(%mark > 0,%mark,1), $calc(%mark2 - %mark)).text
}
alias -l fixhtml { return $remove($regsubex($1-,/#([\d][\d][\d]?);/g,$chr(\t)),&,gt;,lt;) }
ON *:Start:{
Echo -a 4 6You have just loaded 3F4o5r6d7-9T3r4a5n6s7l9a3t4o5r 4 6English Version.
Echo -a 4 6By Ford_Lawnmower
Echo -a 4 6Questions and comments, You can find me in #USA-Chat on irc.geekshed.
Echo -a 4 6irc://irc.geekshed.
}
dialog Translate {
title "Ford-Trans Basic"
size -1 -1 152 137
option dbu
combo 1, 8 8 60 10, drop
combo 2, 84 8 60 10, drop
edit "", 3, 8 32 136 82, multi autovs
button "Translate", 5, 56 115 38 12
combo 6, 84 21 60 10, drop
button "Close", 7, 104 115 38 12, cancel
button " Screen", 8, 10 115 37 12
text "To", 9, 70 10 9 8, center
text "Translate this text to ------->", 10, 6 22 73 8, right
text "", 11, -2 128 153 8, center
}
On *:Dialog:Translate:Sclick:8: {
did -rf $dname 3
}
On *:Dialog:Translate:Sclick:5: {
if (!$did($dname,3).text) {
did -a $dname 11 Type some text in the box to translate
did -f $dname 3
.timer 1 3 did -a $dname 11
return
}
var %trans.text, %trans.lines = $did($dname,3).lines, %trans.count = 1
while (%trans.count < = %trans.lines) { %trans.text = %trans.text $+ $did($dname,3,%trans.count).text inc %trans.count } if ($did($dname,6).seltext == Echo Here) { cevir echo -a $langcode($+($did($dname,1).seltext,_,$did($dname,2).seltext)) %trans.text } else { var %tlanguages = $langcode($+($did($dname,1).seltext,|,$did($dname,2).seltext)) cevir msg $did($dname,6).seltext %tlanguages %trans.text } } On *:Dialog:Translate:init:*: { didtok $dname 1,2 44 English,German,Italian,Spanish,Portuguese,French,Dutch,Albanian,Estonian,Catalan,Croatian,Czech,Danish,Estonian,Filipino didtok $dname 1,2 44 Galician,Hungarian,Indonesian,Latvian,Lithuanian,Maltese,Norwegian,Polish,Romanian,Slovak,Slovenian,Swedish,Turkish did -c $dname 1 1 did -c $dname 2 2 did -ac $dname 6 Echo Here if ($chan(0)) { var %chan.count = $chan(0) while %chan.count { did -a $dname 6 $chan(%chan.count) dec %chan.count } } if ($query(0)) { var %pm.count = $query(0) while (%pm.count) { did -a $dname 6 $query(%pm.count) dec %pm.count } } } alias Trans_Chan { if ($dialog(Trans_Chan)) { dialog -v Trans_Chan Trans_Chan } else { dialog -m Trans_Chan Trans_Chan } } dialog Trans_Chan { title "Translate to /Query" size -1 -1 136 48 option dbu combo 1, 0 0 60 10, drop combo 2, 76 0 60 10, drop text "To", 3, 64 2 9 8 edit "", 4, 0 15 135 10, autohs button "Clear", 5, 2 32 37 12 button "Send", 6, 50 32 37 12 button "Cancel", 7, 96 32 37 12, cancel } On *:Dialog:Trans_Chan:Sclick:6: { if (!$did($dname,4).text) { did -f $dname 4 | return } else { var %tlanguages = $langcode($+($did($dname,1).seltext,|,$did($dname,2).seltext)) if ($active == status window) { cevir echo -a %tlanguages $did($dname,4).text } else { cevir msg $active %tlanguages $did($dname,4).text } } } On *:Dialog:Trans_Chan:Sclick:5: { did -rf Trans_Chan 4 } On *:Dialog:Trans_Chan:init:*: { didtok $dname 1,2 44 English,German,Italian,Spanish,Portuguese,French,Dutch,Albanian,Estonian,Catalan,Croatian,Czech,Danish,Estonian,Filipino didtok $dname 1,2 44 Galician,Hungarian,Indonesian,Latvian,Lithuanian,Maltese,Norwegian,Polish,Romanian,Slovak,Slovenian,Swedish,Turkish did -c $dname 1 1 did -c $dname 2 2 did -f $dname 4 } dialog ClipTrans { title "ClipTrans" size -1 -1 64 48 option dbu combo 1, 1 0 63 10, drop combo 2, 1 20 63 10, drop text "To", 3, 24 11 9 8, center button "Translate", 4, 1 34 29 12 button "Close", 5, 34 34 29 12, cancel } alias -l ClipTrans { if ($dialog(Cliptrans)) { dialog -v Cliptrans Cliptrans } else { dialog -m Cliptrans Cliptrans } } On *:Dialog:ClipTrans:Sclick:4: { var %tlanguages = $langcode($+($did($dname,1).seltext,|,$did($dname,2).seltext)) if ($cb(0)) { TransClip %tlanguages } else { echo -a clipboard is empty } } On *:Dialog:ClipTrans:init:*: { didtok $dname 1,2 44 English,German,Italian,Spanish,Portuguese,French,Dutch,Albanian,Estonian,Catalan,Croatian,Czech,Danish,Estonian,Filipino didtok $dname 1,2 44 Galician,Hungarian,Indonesian,Latvian,Lithuanian,Maltese,Norwegian,Polish,Romanian,Slovak,Slovenian,Swedish,Turkish did -c $dname 1 2 did -c $dname 2 1 } alias -l httpstrip { var %x, %i = $regsub($1-,/(^[^<]*>|< [^>]*>|< [^>]*$)/g,$null,%x), %x = $remove(%x, ,',' ;)
return %x
}
alias -l fixurl return $regsubex($1-,/([^a-z0-9])/ig,% $+ $base($asc(\t),10,16,2))
alias -l transclip {
var %clip.count = $cb(0), %clip.counter = 1, %clip.time = 1
while (%clip.counter < = %clip.count) { .timer 1 %clip.time cevir echo -a $1 $remove($strip($cb(%clip.counter)),$chr(124)) inc %clip.counter inc %clip.time 2 } } alias -l Ford-Trans { if (!$dialog(Translate)) { dialog -m translate translate } else { dialog -v translate translate } } alias -l langcode { var %langcode = $replace($1,english,en,german,de,italian,it,spanish,es,portuguese,pt,french,fr,dutch,nl,albanian,sq,estonian,et,catalan,ca,croatian,hr,czech,cs,$& danish,da,estonian,et,filipino,tl,finnish,fi,galician,gl,hungarian,hu,indonesian,id,latvian,lv,lithuanian,lt,maltese,mt,norwegian,no,polish,pl,romanian,ro,slovak,sk,$& slovenian,sl,swedish,sv,turkish,tr) return %langcode } alias cevir { if ($timer($+(Gtrans,$network,$nick))) { return } .timer $+ $+(Gtrans,$network,$nick) 1 4 noop var %method $iif($regml(1) == !,.msg $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%)/),.msg $nick,msg $chan)) if (help isin $1) { TransHelp %method | return } if (!$3) { %method No text to Çevir | TransHelp %method | return } if (!$regex($left($2,3),/-|_/)) { %method $2- is unknown to me. | TransHelp %method | return } if (!$regex($left($2,2),/en|fr|nl|de|pt|it|es|sq|et|ca|hr|cs|da|et|tl|fi|gl|hu|id|lv|lt|mt|no|pl|ro|sk|sl|sv|tr/i)) { %method $2- is unknown to me. TransHelp %method return } if (!$regex($right($2,2),/en|fr|nl|de|pt|it|es|sq|et|ca|hr|cs|da|et|tl|fi|gl|hu|id|lv|lt|mt|no|pl|ro|sk|sl|sv|tr/i)) { %method $2- is unknown to me. TransHelp %method return } cevir %method $2 $strip($3-) } ;;;;;;;;;;;;;;;; menu * { - .Google Çeviri ..özelde Çeviri:Trans_Chan ..Dialog Kullanım:Ford-Trans ..Diller arası kullanım:dilr ..$iif($group(#TransTrigger) == On,$style(1)) Kanaldakilerin çevirisi örn: !cevir en-tr yes ...$iif($group(#TransTrigger) == On,$style(2)) On: .enable #TransTrigger ...$iif($group(#TransTrigger) == Off,$style(2)) Off: .disable #TransTrigger - }

Bir cevap yazın

E-posta hesabınız yayımlanmayacak.