It isn't particularly clear to me what you want. Perhaps this is why there has been no reponse so far.
You could be talking about some technical aspect of Tcl/IRC/Eggdrop. Perhaps the language of the bot's messages (set in the .conf file) or the character set(s) used by Tcl (see encoding) or even the character sets that particular IRC clients are capable of displaying.
Assuming you are not talking technical, I have created a small script to translate words from one of four languages to another. Even if this is a mile away from what you require, at least it might incite further discussion leading to a better explanation of your needs.
The script uses dictionary.txt in the bot's root directory. I created a minimal file for testing purposes as follows :-
table tabelle table tabla
question frage question pregunta
umbrella regenschirm parapluie paraguas
red rot rouge rojo
Code: Select all
# languages.tcl
bind PUB n !translate pPubTranslate
proc pPubTranslate {nick uhost hand channel txt} {
set arguments [string trim $txt]
if {[llength [split $arguments]] == 3} {
set languages [lrange [split [string tolower $arguments]] 0 1]
if {[regexp -nocase -- {(en|de|fr|es) (en|de|fr|es)} [join $languages]]} {
set fr [lindex $languages 0]
set to [lindex $languages 1]
if {![string equal $fr $to]} {
set word [lindex [split $arguments] 2]
set fp [open dictionary.txt r]
set data [split [read $fp] \n]
close $fp
set fridx [string map {en 0 de 1 fr 2 es 3} $fr]
set toidx [string map {en 0 de 1 fr 2 es 3} $to]
set found 0
foreach item $data {
if {[string equal -nocase $word [lindex [split $item] $fridx]]} {
set found 1
putserv "PRIVMSG $channel :($fr) $word -> ($to) [lindex [split $item] $toidx]"
break
}
}
if {!$found} {putserv "PRIVMSG $channel :$word not found"}
} else {putserv "PRIVMSG $channel :'from' and 'to' languages must be different"}
} else {putserv "PRIVMSG $channel :'from' and 'to' languages must each be one of en, de, fr, es"}
} else {putserv "PRIVMSG $channel :correct syntax is !translate <from> <to> <word>"}
return 0
}
Typical output is as follows :-
[14:32] <@arfer> !translate es de rojo
[14:32] <@osmosis> (es) rojo -> (de) rot
[14:33] <@arfer> !translate en de umbrella
[14:33] <@osmosis> (en) umbrella -> (de) regenschirm
The script is pretty useless as it stands. It would be better to use one of the http translation scripts for such translations. The script only translates single words and not phrases. The script does not account for a word in one language having two or more different meanings, yet are represented in other languages by different words.
Using this as a starting point, what is it that you are asking for?