I replaced a function named list for "dias".caesar wrote:You get that error cos you seem to have a function named list. Find it and replace it with something else.
I do what you've recommended but still gives me another error.set signon [string map [dias "Mon" "Lun" "Tue" "Mar" "Wed" "Mie" "Thur" "Jue" "Fri" "Vie" "Sat" "Sab" "Sun" "Dom"] $signon]
Tcl error [whois::317]: invalid command name "dias"
Being the word in bracket [ dias] is interpreted as a command.
Edit: I changed my original idea
As I see it is very difficult to translate into Spanish the signon variable, I replaced my original idea, using uptime.
In this code I could translate uptime to Spanish:
Code: Select all
proc whois::317 {from key text} {
set upesp [duration [expr [unixtime] - $::uptime]]
regsub -all "year" $upesp "año" upesp
regsub -all "years" $upesp "años" upesp
regsub -all "month" $upesp "mes" upesp
regsub -all "months" $upesp "meses" upesp
regsub -all "week" $upesp "semana" upesp
regsub -all "weeks" $upesp "semanas" upesp
regsub -all "day" $upesp "día" upesp
regsub -all "days" $upesp "días" upesp
regsub -all "hour" $upesp "hora" upesp
regsub -all "hours" $upesp "horas" upesp
regsub -all "minute" $upesp "minuto" upesp
regsub -all "minutes" $upesp "minutos" upesp
regsub -all "second" $upesp "segundo" upesp
regsub -all "seconds" $upesp "segundos" upesp
if {[regexp -- {.*\s(\d+)\s(\d+)\s\:} $text wholematch idle]} {
set idlesp [duration $idle]
regsub -all "year" $idlesp "año" idlesp
regsub -all "years" $idlesp "años" idlesp
regsub -all "month" $idlesp "mes" idlesp
regsub -all "months" $idlesp "meses" idlesp
regsub -all "week" $idlesp "semana" idlesp
regsub -all "weeks" $idlesp "semanas" idlesp
regsub -all "day" $idlesp "día" idlesp
regsub -all "days" $idlesp "días" idlesp
regsub -all "hour" $idlesp "hora" idlesp
regsub -all "hours" $idlesp "horas" idlesp
regsub -all "minute" $idlesp "minuto" idlesp
regsub -all "minutes" $idlesp "minutos" idlesp
regsub -all "second" $idlesp "segundo" idlesp
regsub -all "seconds" $idlesp "segundos" idlesp
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Conectado :${whois::textf} \
$upesp ${whois::tagf}Inactivo:${whois::textf} $idlesp"
}
}
New Edit: Traslate idle and set colors textf of above original code16:49 : @oper¦ !whois roger
16:49 ? @Mybot ¦ [Whois] Host: roger (roger@roger.oper) Realname: roger
16:49 ? @Mybot ¦ [Whois] Canales: @#channel1 @#channel2
16:49 ? @Mybot ¦ [Whois] Servidor: myserver.com
16:49 ? @Mybot ¦ [Whois] Services: Nick Registrado
16:49 ? @Mybot ¦ [Whois] Conectado: 1 hora 15 minutos 25 segundos Inactivo: 4 minutos 43 segundos
Final Edit: Days and Months in Spanish
With regsub also got what I wanted in my original idea.
Code: Select all
proc whois::317 {from key text} {
if {[regexp -- {.*\s(\d+)\s(\d+)\s\:} $text wholematch idle signon]} {
set signonsp [ctime $signon]
regsub -all "Mon" $signonsp "Lun" signonsp
regsub -all "Tue" $signonsp "Mar" signonsp
regsub -all "Wed" $signonsp "Mie" signonsp
regsub -all "Thur" $signonsp "Jue" signonsp
regsub -all "Fri" $signonsp "Vie" signonsp
regsub -all "Sat" $signonsp "Sab" signonsp
regsub -all "Sun" $signonsp "Dom" signonsp
regsub -all "Jan" $signonsp "Ene" signonsp
regsub -all "Apr" $signonsp "Abr" signonsp
regsub -all "Aug" $signonsp "Ago" signonsp
regsub -all "Dec" $signonsp "Dic" signonsp
set idlesp [duration $idle]
regsub -all "year" $idlesp "año" idlesp
regsub -all "years" $idlesp "años" idlesp
regsub -all "month" $idlesp "mes" idlesp
regsub -all "months" $idlesp "meses" idlesp
regsub -all "week" $idlesp "semana" idlesp
regsub -all "weeks" $idlesp "semanas" idlesp
regsub -all "day" $idlesp "día" idlesp
regsub -all "days" $idlesp "días" idlesp
regsub -all "hour" $idlesp "hora" idlesp
regsub -all "hours" $idlesp "horas" idlesp
regsub -all "minute" $idlesp "minuto" idlesp
regsub -all "minutes" $idlesp "minutos" idlesp
regsub -all "second" $idlesp "segundo" idlesp
regsub -all "seconds" $idlesp "segundos" idlesp
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Conectado :${whois::textf} \
$signonsp ${whois::tagf}Inactivo:${whois::textf} $idlesp"
}
}
16:49 : @oper¦ !whois roger
16:49 ? @Mybot ¦ [Whois] Host: roger (roger@roger.oper) Realname: roger
16:49 ? @Mybot ¦ [Whois] Canales: @#channel1 @#channel2
16:49 ? @Mybot ¦ [Whois] Servidor: myserver.com
16:49 ? @Mybot ¦ [Whois] Services: Nick Registrado
16:49 ? @Mybot ¦ [Whois] Conectado: Mie Abr 15 15:34:16 2015 Inactivo: 2 minutos 31 segundos