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.

Sex Dice (Current Version: 1.3b MultiLanguage by CrazyCat)

Support & discussion of released scripts, and announcements of new releases.
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Why don't you use an array?

Code: Select all

set langDef(en) {
	msg1 {Hello World!}
	msg2 {etc...}
}

set langDef(fr) {
	msg1 {Bonjour Monde!}
	msg2 {etc...}
}

proc setlang {lang} {
	array set ::lang $::langDef($lang)
}
Test:

Code: Select all

% setlang en
% puts $lang(msg1)
Hello World!
% setlang fr
% puts $lang(msg1)
Bonjour Monde!
Of course, there are other ways to do this...eg. combining the "message id" and language name to make the element name in your language array (to avoid having to create the array when switching languages - which is better if you need several languages simultaneously)

Code: Select all

set lang(en,msg1) "Hello World!"
Have you ever read "The Manual"?
User avatar
CrazyCat
Revered One
Posts: 1306
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Thx user, I think your first solution is the better for me.

I'll next time use msgcat package to do multilanguage tcl, but when I first want to try this way :)
User avatar
CrazyCat
Revered One
Posts: 1306
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

So, I can confirm that your solution works perfectly, I'll release soon the multilanguage version :)
User avatar
CrazyCat
Revered One
Posts: 1306
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

OK, the beta version is released here

Peharps some bugs, so tell me if you encounter any issue.
B
BeBoo
Halfop
Posts: 42
Joined: Wed Sep 26, 2007 1:44 am

Post by BeBoo »

Changed first post with information. Thanks, CrazyCat!!
User avatar
CrazyCat
Revered One
Posts: 1306
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

You're welcome :)

If no-one report me any bug or issue before sunday, I'll officially release it on eggdrop.fr :)
User avatar
wac
Halfop
Posts: 80
Joined: Sun Dec 10, 2006 1:22 am
Location: in my cardboard box

Post by wac »

the english only one is down and the 'multi-language' one is only does french replies, so as it's not 'multi-language' ... lol
I see j00!
Post Reply