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.
Support & discussion of released scripts, and announcements of new releases.
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Tue Oct 30, 2007 10:40 am
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)
Have you ever read "The Manual"?
CrazyCat
Revered One
Posts: 1306 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Tue Oct 30, 2007 12:59 pm
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
CrazyCat
Revered One
Posts: 1306 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Wed Oct 31, 2007 4:51 am
So, I can confirm that your solution works perfectly, I'll release soon the multilanguage version
CrazyCat
Revered One
Posts: 1306 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Wed Oct 31, 2007 9:16 am
OK, the beta version is released
here
Peharps some bugs, so tell me if you encounter any issue.
BeBoo
Halfop
Posts: 42 Joined: Wed Sep 26, 2007 1:44 am
Post
by BeBoo » Fri Nov 02, 2007 10:41 am
Changed first post with information. Thanks, CrazyCat!!
CrazyCat
Revered One
Posts: 1306 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Fri Nov 02, 2007 12:33 pm
You're welcome
If no-one report me any bug or issue before sunday, I'll officially release it on eggdrop.fr
wac
Halfop
Posts: 80 Joined: Sun Dec 10, 2006 1:22 am
Location: in my cardboard box
Post
by wac » Fri Dec 26, 2008 5:27 am
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!