• Home
  • Servers
  • Chat
  • Channels
  • Commands
  • Forum
  • FAQ
  • Software
  • Quotes
Topic Options
Rate This Topic
#4335 - 02/23/09 01:40 PM Active Language Translator Script for mIRC :)
FordLawnmower Offline
Over 100 posts

Registered: 02/15/09
Posts: 111
Loc: Ohio
This script is my baby smile I really never stop working on this one. This is the basic english version of the script. In my opinion, it is by far, the best language translation script ever made for mirc. Because you can quickly type in your language and send in another and Copy the foreign language text from the screen and paste it back in your language. It allows you to keep up with the fastest conversations, without hesitation. All the translations come from babelfish and have nothing to do with the script. I only speak english , haha.
Usage: Copy to clipboard, paste to new remote, save with a unique file name , right click the channel or query window to see the translation options. See the notes on the script for more instructions. I'll attach the file at the bottom.
Code:
;***
;***
;Easy mIRC Translator by Ford_Lawnmower
;This script gets a translation from yahoo babelfish.
;I used simple popup menus to make this very useful for realtime chat.
;Just right click the channel screen, select languages, and enter your text :)
;Outgoing will post the translation to the active channel.
;InComming will translate the contents of the clipboard and echo it back to the active screen.
;To use InComming translation, just mark some text on the screen, select Translation,InComming then chose a language.
alias -l httpstrip {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;)
  return %x
}
alias -l fixurl {
  set %zz $1-
  var %ii = 40
  while (%ii <= 42) {
    if ($chr(%ii) isin %zz) { set %zz $remove(%zz,$chr(%ii)) }
    inc %ii
  }
  var %ii = 60
  while (%ii <= 62) {
    if ($chr(%ii) isin %zz) { set %zz $remove(%zz,$chr(%ii)) }
    inc %ii
  }
  if ($chr(44) isin %zz) { set %zz $replace(%zz,$chr(44),$chr(37) $+ $hex(44)) }
  var %ii = 91
  while (%ii <= 96) {
    if ($chr(%ii) isin %zz) { set %zz $remove(%zz,$chr(%ii)) }
    inc %ii
  }
  var %ii = 123
  while (%ii <= 191) {
    if ($chr(%ii) isin %zz) { set %zz $remove(%zz,$chr(%ii)) }
    inc %ii
  }
  var %ii = 192
  while (%ii <= 201) {
    if ($chr(%ii) isin %zz) { set %zz $replace(%zz,$chr(%ii),$chr(37) $+ C3 $+ $chr(37) $+ $calc(%ii - 112)) }
    inc %ii
  }
  if ($chr(39) isin %zz) { set %zz $remove(%zz,$chr(39)) }
  if ($chr(59) isin %zz) { set %zz $replace(%zz,$chr(59),$chr(37) $+ $hex(59)) }
  if ($chr(35) isin %zz) { set %zz $replace(%zz,$chr(35),$chr(37) $+ $hex(35)) }
  if ($chr(60) isin %zz) { set %zz $replace(%zz,$chr(60),$chr(37) $+ $hex(60)) }
  if ($chr(62) isin %zz) { set %zz $replace(%zz,$chr(62),$chr(37) $+ $hex(62)) }
  if ($chr(202) isin %zz) { set %zz $replace(%zz,$chr(202),$chr(37) $+ C3 $+ $chr(37) $+ 8A) }
  if ($chr(203) isin %zz) { set %zz $replace(%zz,$chr(203),$chr(37) $+ C3 $+ $chr(37) $+ 8B) }
  if ($chr(204) isin %zz) { set %zz $replace(%zz,$chr(204),$chr(37) $+ C3 $+ $chr(37) $+ 8C) }
  if ($chr(205) isin %zz) { set %zz $replace(%zz,$chr(205),$chr(37) $+ C3 $+ $chr(37) $+ 8D) }
  if ($chr(206) isin %zz) { set %zz $replace(%zz,$chr(206),$chr(37) $+ C3 $+ $chr(37) $+ 8E) }
  if ($chr(207) isin %zz) { set %zz $replace(%zz,$chr(207),$chr(37) $+ C3 $+ $chr(37) $+ 8F) }
  if ($chr(218) isin %zz) { set %zz $replace(%zz,$chr(218),$chr(37) $+ C3 $+ $chr(37) $+ 9A) }
  if ($chr(219) isin %zz) { set %zz $replace(%zz,$chr(219),$chr(37) $+ C3 $+ $chr(37) $+ 9B) }
  if ($chr(220) isin %zz) { set %zz $replace(%zz,$chr(220),$chr(37) $+ C3 $+ $chr(37) $+ 9C) }
  if ($chr(221) isin %zz) { set %zz $replace(%zz,$chr(221),$chr(37) $+ C3 $+ $chr(37) $+ 9D) }
  if ($chr(222) isin %zz) { set %zz $replace(%zz,$chr(222),$chr(37) $+ C3 $+ $chr(37) $+ 9E) }
  if ($chr(223) isin %zz) { set %zz $replace(%zz,$chr(223),$chr(37) $+ C3 $+ $chr(37) $+ 9F) }
  if ($chr(224) isin %zz) { set %zz $replace(%zz,$chr(224),$chr(37) $+ C3 $+ $chr(37) $+ A0) }
  if ($chr(225) isin %zz) { set %zz $replace(%zz,$chr(225),$chr(37) $+ C3 $+ $chr(37) $+ A1) }
  if ($chr(226) isin %zz) { set %zz $replace(%zz,$chr(226),$chr(37) $+ C3 $+ $chr(37) $+ A2) }
  if ($chr(227) isin %zz) { set %zz $replace(%zz,$chr(227),$chr(37) $+ C3 $+ $chr(37) $+ A3) }
  if ($chr(228) isin %zz) { set %zz $replace(%zz,$chr(228),$chr(37) $+ C3 $+ $chr(37) $+ A4) }
  if ($chr(229) isin %zz) { set %zz $replace(%zz,$chr(229),$chr(37) $+ C3 $+ $chr(37) $+ A5) }
  if ($chr(230) isin %zz) { set %zz $replace(%zz,$chr(230),$chr(37) $+ C3 $+ $chr(37) $+ A6) }
  if ($chr(231) isin %zz) { set %zz $replace(%zz,$chr(231),$chr(37) $+ C3 $+ $chr(37) $+ A7) }
  if ($chr(232) isin %zz) { set %zz $replace(%zz,$chr(232),$chr(37) $+ C3 $+ $chr(37) $+ A8) }
  if ($chr(233) isin %zz) { set %zz $replace(%zz,$chr(233),$chr(37) $+ C3 $+ $chr(37) $+ A9) }
  if ($chr(234) isin %zz) { set %zz $replace(%zz,$chr(234),$chr(37) $+ C3 $+ $chr(37) $+ AA) }
  if ($chr(235) isin %zz) { set %zz $replace(%zz,$chr(235),$chr(37) $+ C3 $+ $chr(37) $+ AB) }
  if ($chr(236) isin %zz) { set %zz $replace(%zz,$chr(236),$chr(37) $+ C3 $+ $chr(37) $+ AC) }
  if ($chr(237) isin %zz) { set %zz $replace(%zz,$chr(237),$chr(37) $+ C3 $+ $chr(37) $+ AD) }
  if ($chr(238) isin %zz) { set %zz $replace(%zz,$chr(238),$chr(37) $+ C3 $+ $chr(37) $+ AE) }
  if ($chr(239) isin %zz) { set %zz $replace(%zz,$chr(239),$chr(37) $+ C3 $+ $chr(37) $+ AE) }
  if ($chr(240) isin %zz) { set %zz $replace(%zz,$chr(240),$chr(37) $+ C3 $+ $chr(37) $+ B0) }
  if ($chr(241) isin %zz) { set %zz $replace(%zz,$chr(241),$chr(37) $+ C3 $+ $chr(37) $+ B1) }
  if ($chr(242) isin %zz) { set %zz $replace(%zz,$chr(242),$chr(37) $+ C3 $+ $chr(37) $+ B2) }
  if ($chr(243) isin %zz) { set %zz $replace(%zz,$chr(243),$chr(37) $+ C3 $+ $chr(37) $+ B3) }
  if ($chr(244) isin %zz) { set %zz $replace(%zz,$chr(244),$chr(37) $+ C3 $+ $chr(37) $+ B4) }
  if ($chr(245) isin %zz) { set %zz $replace(%zz,$chr(245),$chr(37) $+ C3 $+ $chr(37) $+ B5) }
  if ($chr(246) isin %zz) { set %zz $replace(%zz,$chr(246),$chr(37) $+ C3 $+ $chr(37) $+ B6) }
  if ($chr(247) isin %zz) { set %zz $replace(%zz,$chr(247),$chr(37) $+ C3 $+ $chr(37) $+ B7) }
  if ($chr(248) isin %zz) { set %zz $replace(%zz,$chr(248),$chr(37) $+ C3 $+ $chr(37) $+ B8) }
  if ($chr(249) isin %zz) { set %zz $replace(%zz,$chr(249),$chr(37) $+ C3 $+ $chr(37) $+ B9) }
  if ($chr(250) isin %zz) { set %zz $replace(%zz,$chr(250),$chr(37) $+ C3 $+ $chr(37) $+ BA) }
  if ($chr(251) isin %zz) { set %zz $replace(%zz,$chr(251),$chr(37) $+ C3 $+ $chr(37) $+ BB) }
  if ($chr(252) isin %zz) { set %zz $replace(%zz,$chr(252),$chr(37) $+ C3 $+ $chr(37) $+ BC) }
  if ($chr(253) isin %zz) { set %zz $replace(%zz,$chr(253),$chr(37) $+ C3 $+ $chr(37) $+ BD) }
  if ($chr(254) isin %zz) { set %zz $replace(%zz,$chr(254),$chr(37) $+ C3 $+ $chr(37) $+ BE) }
  if ($chr(255) isin %zz) { set %zz $replace(%zz,$chr(255),$chr(37) $+ C3 $+ $chr(37) $+ BF) }
  var %ii = 208
  while (%ii <= 217) {
    if ($chr(%ii) isin %zz) { set %zz $replace(%zz,$chr(%ii),$chr(37) $+ C3 $+ $chr(37) $+ $calc(%ii - 118)) }
    inc %ii
  }
  return %zz
}
alias -l hex {
  set %III $base($1,10,16)
  return %III
}
alias  timeout {
  echo -a Connection was timed out... We could not find your Translation... :(
  trans.clear
}
alias trans.clear {
  unset %trans*
  .timerTransSockClose 1 10 sockclose trans*
  .timer-trans off
  halt
}
alias trans {
  ;if (%trans.inuse == 1) { echo -a Slow down or you will risk getting banned from babelfish | trans.clear }
  set %trans.inuse 1
  set %trans.nick $me
  set %trans.chan $active
  set %trans.text $remove($replace($3-,$chr(32),$chr(37) $+ 20),*)
  set %trans.text $fixurl(%trans.text)
  set %trans.code $2
  set %trans.flag $1
  sockclose trans $+ $chan $+ $nick $+ $right($time,2)
  set %transurl /translate_txt?doit=done&lp= $+ %trans.code $+ &intl=1&ei=utf8&trtext= $+ %trans.text
  set %transsite babelfish.yahoo.com
  ;The line below was for testing
  ;.notice %trans.nick opening Http:// $+ %transsite $+ %transurl
  sockopen trans $+ $chan $+ $nick $+ $right($time,2) %transsite 80
  .timer-trans 1 15 timeout
}
#TransTrigger on
On !*:Text:!trans*:#: {
  if (%trans.inuse == 1) { .notice $nick -a Slow down or you will risk getting banned from babelfish | trans.clear }
  set %trans.inuse 1
  set %trans.nick $nick
  set %trans.chan $chan
  set %trans.text $remove($replace($3-,$chr(32),$chr(37) $+ 20),*)
  set %trans.text $fixurl(%trans.text)
  set %trans.code $replace($2,-,_)
  set %trans.flag -a
  sockclose trans
  set %transurl /translate_txt?doit=done&lp= $+ %trans.code $+ &intl=1&ei=utf8&trtext= $+ %trans.text
  set %transsite babelfish.yahoo.com
  ;The line below was for testing
  ;.notice %trans.nick opening Http:// $+ %transsite $+ %transurl
  sockopen trans %transsite 80
  .timer-trans 1 15 timeout
}
#TransTrigger end
on *:sockopen:trans*: {
  sockwrite -n $sockname GET %transurl HTTP/1.1
  sockwrite -n $sockname Host: %transsite $+ $CRLF $+ $CRLF
}
on *:sockread:trans*: {
  if ($sockerr > 0) { .notice %trans.nick There has been an error... We could not retrive your translation. Sorry | trans.clear }
  else {
    var %transvar |  sockread %transvar
    ;the echo line below is for testing..
    ;echo %transvar
    if (id="result" isin %transvar) {
      if (%trans.flag == -a) { msg %trans.chan $httpstrip(%transvar) }
      if (%trans.flag == -e) { echo -t %trans.chan 09 $+ $httpstrip(%transvar) }
      ;if (%trans.flag == -r) { return $httpstrip(%transvar) }
      sockread %transvar
      trans.clear
    }
  }
}
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 #Technical on irc.mindforge.org
  Echo -a 4 6irc://irc.mindforge.org
  hmake acronym 10
  hmake TransNow 10
  if ($isFile(acronyms.hsh)) { hload acronym acronyms.hsh }
  if ($isFile(TransNow.hsh)) { hload TransNow TransNow.hsh }
  if (!$isFile(acronyms.hsh)) { acronym.init | hsave -o acronym acronyms.hsh }
}
;****** End of Script....Start of Popups *******
menu channel {
  .TransTrigger
  .On:.enable #transtrigger
  .Off:.disable #transtrigger
  -
  .Trans-Outgoing
  ..English to German:trans -a en_de $?="Enter the text to be translated"
  ..English to Italian:trans -a en_it $?="Enter the text to be translated"
  ..English to Spanish:trans -a en_es $?="Enter the text to be translated"
  ..English to Portuguese:trans -a en_pt $?="Enter the text to be translated"
  ..English to French:trans -a en_fr $?="Enter the text to be translated"
  ..English to Dutch:trans -a en_nl $?="Enter the text to be translated"
  ..German to English:trans -e de_en $?="Enter the text to be translated"
  ..Italian to English:trans -e it_en $?="Enter the text to be translated"
  ..Spanish to English:trans -e es_en $?="Enter the text to be translated"
  ..Portuguese to English:trans -e pt_en $?="Enter the text to be translated"
  ..French to English:trans -e fr_en $?="Enter the text to be translated"
  ..Dutch to English:trans -e nl_en $?="Enter the text to be translated"
}
menu channel {
  -
  .Trans-InComming
  ..German to English:trans -e de_en $strip($cb)
  ..Italian to English:trans -e it_en $strip($cb)
  ..Spanish to English:trans -e es_en $strip($cb)
  ..Portuguese to English:trans -e pt_en $strip($cb)
  ..French to English:trans -e fr_en $strip($cb)
  ..Dutch to English:trans -e nl_en $strip($cb)
  ..English to German:trans -e en_de $strip($cb)
  ..English to Italian:trans -e en_it $strip($cb)
  ..English to Spanish:trans -e en_es $strip($cb)
  ..English to Portuguese:trans -e en_pt $strip($cb)
  ..English to French:trans -e en_fr $strip($cb)
  ..English to Dutch:trans -e en_nl $strip($cb)
}
menu query {
  -
  .Trans-Outgoing
  ..English to German:trans -a en_de $?="Enter the text to be translated"
  ..English to Italian:trans -a en_it $?="Enter the text to be translated"
  ..English to Spanish:trans -a en_es $?="Enter the text to be translated"
  ..English to Portuguese:trans -a en_pt $?="Enter the text to be translated"
  ..English to French:trans -a en_fr $?="Enter the text to be translated"
  ..English to Dutch:trans -a en_nl $?="Enter the text to be translated"
  ..German to English:trans -e de_en $?="Enter the text to be translated"
  ..Italian to English:trans -e it_en $?="Enter the text to be translated"
  ..Spanish to English:trans -e es_en $?="Enter the text to be translated"
  ..Portuguese to English:trans -e pt_en $?="Enter the text to be translated"
  ..French to English:trans -e fr_en $?="Enter the text to be translated"
  ..Dutch to English:trans -e nl_en $?="Enter the text to be translated"
}
menu query {
  -
  .Trans-InComming
  ..German to English:trans -e de_en $strip($cb)
  ..Italian to English:trans -e it_en $strip($cb)
  ..Spanish to English:trans -e es_en $strip($cb)
  ..Portuguese to English:trans -e pt_en $strip($cb)
  ..French to English:trans -e fr_en $strip($cb)
  ..Dutch to English:trans -e nl_en $strip($cb)
  ..English to German:trans -e en_de $strip($cb)
  ..English to Italian:trans -e en_it $strip($cb)
  ..English to Spanish:trans -e en_es $strip($cb)
  ..English to Portuguese:trans -e en_pt $strip($cb)
  ..English to French:trans -e en_fr $strip($cb)
  ..English to Dutch:trans -e en_nl $strip($cb)
}


Attachments
Ford-Trans-Basic.rar (72 downloads)

_________________________
If you already know everything, You can never learn anything :P

Top
Sponsored Links
Sponsored Links
Member
*****

Registered: 27/08/04
Posts: 10136
Loc: Mountain View, CA
Top


Moderator:  Jeff, mandy, usrbingeek