egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sex Dice (Current Version: 1.3b MultiLanguage by CrazyCat)
Goto page Previous  1, 2
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Tue Oct 30, 2007 10:40 am    Post subject: Reply with quote

Why don't you use an array?
Code:

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:

% 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:
set lang(en,msg1) "Hello World!"

_________________
Have you ever read "The Manual"?
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Tue Oct 30, 2007 12:59 pm    Post subject: Reply with quote

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 Smile
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Wed Oct 31, 2007 4:51 am    Post subject: Reply with quote

So, I can confirm that your solution works perfectly, I'll release soon the multilanguage version Smile
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Wed Oct 31, 2007 9:16 am    Post subject: Reply with quote

OK, the beta version is released here

Peharps some bugs, so tell me if you encounter any issue.
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
BeBoo
Halfop


Joined: 26 Sep 2007
Posts: 42

PostPosted: Fri Nov 02, 2007 10:41 am    Post subject: Reply with quote

Changed first post with information. Thanks, CrazyCat!!
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Fri Nov 02, 2007 12:33 pm    Post subject: Reply with quote

You're welcome Smile

If no-one report me any bug or issue before sunday, I'll officially release it on eggdrop.fr Smile
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
wac
Halfop


Joined: 10 Dec 2006
Posts: 80
Location: in my cardboard box

PostPosted: Fri Dec 26, 2008 5:27 am    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber