This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

ChanRelay 4.0 i18n

Support & discussion of released scripts, and announcements of new releases.
User avatar
CrazyCat
Revered One
Posts: 1216
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

ChanRelay 4.0 i18n

Post by CrazyCat »

New version of chanrelay : https://gitlab.com/tcl-scripts/chanrela ... nrelay-4.0

Short changelog:
- Internationalisation (i18n) using msgcat
- All files (logs, settings, translations) are moved in crtools/ directory

Do not hesitate to transmit me corrections in translations (or correct directly in gitlab) or send me new languages
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

Awesome work CrazyCat, as always :wink:
ComputerTech
s
skydrome
Voice
Posts: 1
Joined: Mon Apr 05, 2021 7:41 pm

Post by skydrome »

Hello, Im confused as how the script sends the messages to the bots by its username.
My bot's user handles are theyre nicks and they have different usernames so [islinked $bot] is always false
Should i .+bot in a different manner?
User avatar
CrazyCat
Revered One
Posts: 1216
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Well, I did the script with the assertion that the bots are added using their username, which is often their botnet-nick too.
The better way is to make chanrelay working is to do the .+bot <username> when creating your botnet.
Note that the bot handle is just informative.

If you have troubles to set up chanrelay, I can make an adapted version of it for particular cases :)
User avatar
vam2u
Voice
Posts: 31
Joined: Sat Mar 27, 2021 11:19 pm
Location: Malaysia

Post by vam2u »

I'm having below error:-
Hope to get some help or advice on how to resolve it :-)
Thanks!

Code: Select all

[06:40:45] Tcl error [::crelay::trans:topic]: expected integer but got "GREGORIAN_CHANGE_DATE"
[06:41:01] Tcl error [::crelay::trans:join]: expected integer but got "GREGORIAN_CHANGE_DATE"
[06:41:01] Tcl error [::crelay::trans:topic]: expected integer but got "GREGORIAN_CHANGE_DATE"
[06:41:01] Tcl error [::crelay::trans:pub]: expected integer but got "GREGORIAN_CHANGE_DATE"
[06:41:14] Tcl error [::crelay::trans:join]: expected integer but got "GREGORIAN_CHANGE_DATE"
[06:41:14] Tcl error [::crelay::trans:topic]: expected integer but got "GREGORIAN_CHANGE_DATE"
[06:42:09] Tcl error [::crelay::trans:part]: expected integer but got "GREGORIAN_CHANGE_DATE"
User avatar
CrazyCat
Revered One
Posts: 1216
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Please do a .set errorInfo in party-line just after having the error, it will give more informations about it

The error could be in the dlog procedure, you can try to set debug to 0
User avatar
vam2u
Voice
Posts: 31
Joined: Sat Mar 27, 2021 11:19 pm
Location: Malaysia

Post by vam2u »

Hey CrazyCat, thanks for your prompt reply.
Here you go:-

Code: Select all

Currently: expected integer but got "GREGORIAN_CHANGE_DATE"
Currently:     while executing
Currently: "GetDateFields $clockval  $TZData($timezone)  GREGORIAN_CHANGE_DATE"
Currently:     (procedure "::tcl::clock::formatproc'%Y-%m-%d %H\:%M\:%S'c" line 4)
Currently:     invoked from within
Currently: "$procName $clockval $timezone"
Currently:     (procedure "::tcl::clock::format" line 34)
Currently:     invoked from within
Currently: "clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S""
Currently:     (procedure "dlog" line 3)
Currently:     invoked from within
Currently: "dlog "Prepare transmission : >quit $chan $nick $text" "
Currently:     (procedure "::crelay::trans:quit" line 2)
Currently:     invoked from within
Currently: "::crelay::trans:quit $_stnm1 $_stnm2 $_stnm3 $_stnm4 $_stnm5"
User avatar
CrazyCat
Revered One
Posts: 1216
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Ok, it a trouble with the clock, so disable the debug.

I'll try to find a solution, this seems to be a known trouble with tcl
User avatar
CrazyCat
Revered One
Posts: 1216
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Ok, solution found :)

replace the actual i18n proc with the following:

Code: Select all

proc i18n {msgfile {lang {}} } {
	if {$lang == ""} {set lang [string range [::msgcat::mclocale] 0 1] }
	if { [catch {open $msgfile r} fmsg] } {
		putlog "\002ChanRelay\002 - Could not open $msgfile for reading\n$fmsg"
	} else {
		putlog "\002ChanRelay\002 - Loading $lang file from $msgfile"
		while {[gets $fmsg line] >= 0} {
			lappend ll $line
		}
		close $fmsg
		::msgcat::mcmset $lang [join $ll]
		unset ll
	}
	::msgcat::mclocale $lang
	# Hack for badly managed locales
	if { [::msgcat::mc GREGORIAN_CHANGE_DATE] == "GREGORIAN_CHANGE_DATE"} {
		::msgcat::mcset [::msgcat::mclocale] GREGORIAN_CHANGE_DATE 2299527
	}
}
The trouble came from a trouble in msgcat and some timezones which are badly managed, I wonder you setted a language which is not in the original list :)
User avatar
vam2u
Voice
Posts: 31
Joined: Sat Mar 27, 2021 11:19 pm
Location: Malaysia

Post by vam2u »

Yeah the error is gone when I disable the debug, thanks!
But let's see if I'm able to get the relay to work :-)
User avatar
vam2u
Voice
Posts: 31
Joined: Sat Mar 27, 2021 11:19 pm
Location: Malaysia

Post by vam2u »

Wow that's fast you found the solution, I set the language to "english"
User avatar
vam2u
Voice
Posts: 31
Joined: Sat Mar 27, 2021 11:19 pm
Location: Malaysia

Post by vam2u »

I have replace the actual i18n proc with the following, but I still get the same error if I change back the debug mode to 1.

Code: Select all

[09:27:06] Tcl error [::crelay::trans:pub]: expected integer but got "GREGORIAN_CHANGE_DATE"
[09:27:47] Tcl error [::crelay::trans:quit]: expected integer but got "GREGORIAN_CHANGE_DATE"
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Followed the error to the mc proc and I fail to understand what's is it's purpose.

Code: Select all

proc mc {text {str ""} args} { return [format $text $str $args] }
given that it's use is:

Code: Select all

if { [::msgcat::mc GREGORIAN_CHANGE_DATE] == "GREGORIAN_CHANGE_DATE"} {
      ::msgcat::mcset [::msgcat::mclocale] GREGORIAN_CHANGE_DATE 2299527
   } 
Care to shed some light on it?
Once the game is over, the king and the pawn go back in the same box.
User avatar
CrazyCat
Revered One
Posts: 1216
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

If you setted english as lang, the error must not occure. And even if you don't have the english locale (I doubt of this), the hack I did must correct that.
BTW, I'll look a little bit more.
@vam2u: can you reload the script (.tcl source scripts/chanrelay.tcl) and copy here the message about the lang loading ?

@caesar: the proc I create is to fake msgcat when the package is not available (just return format without translation).
The hack I did in i18n is not applied if msgcat is absent, as i18n is called if the catch works.

Three cases occures:
1. msgcat is here and the locale is ok, the translation is done with msgcat
2. msgcat is absent, there is no translation and a simple format is applied
3. msgcat is here but the locale is missing/unknown, I force the GREGORIAN_CHANGE_DATE to the most used value
User avatar
vam2u
Voice
Posts: 31
Joined: Sat Mar 27, 2021 11:19 pm
Location: Malaysia

Post by vam2u »

@CrazyCat

Here you go, below is the message i get.

.tcl source scripts/chanrelay.tcl
[22:03:04] CHANRELAY 4.00 by CrazyCat loaded - https://www.eggdrop.fr
Tcl:
Post Reply