multilingual game

Get help using Construct 2

Post » Tue Jun 11, 2013 3:01 pm

Hi all,

I was wondering what the correct way was to create a multilingual game.
I'll have to develop a game which lets you choose your language before you start. If chosen French, all the text should be in French and if Dutch... you get the point.

Now how should I do this? Should I create a global variable "language" and check what it is after the option screen, then set all text to its correspondent language? Seems like the only way to go but it looks so devious to me.

Thanks for your help!
B
4
Posts: 9
Reputation: 220

Post » Tue Jun 11, 2013 6:49 pm

Im using a global variable like you said, that only changes in options screen, and i have a dictionary that has all text, for example:

OptionS is the name of the entry for "options" in spanish, OptionsE is the name of the entry for "options" in english, and my global variable is called LANG and have "S" value or "E" value, then i use this:

Text.SetText -> Dic.Get("Options" & LANG)ByR2013-06-11 18:51:24
B
31
S
7
G
2
Posts: 159
Reputation: 3,739

Post » Wed Jun 12, 2013 8:56 am

Thanks a lot!
B
4
Posts: 9
Reputation: 220

Post » Wed Jun 12, 2013 1:50 pm

Hmm, I'm getting a 0 result when I try to get the value from the Dictionary.

When I display the text I get the correct result: welcomeTextN or welcomeTextF, depending on the chosen language.

Yet when I do Dictionary.Get("welcomeText" & language) it returns 0. I'm 100% sure the key value is welcomeTextF & welcomeTextN. Strange... Any ideas?
B
4
Posts: 9
Reputation: 220

Post » Wed Jun 12, 2013 2:20 pm

-Are you filling the dictionary value after or before you call it?

-Revise Caps

-Try to write in the screen "welcomeText" & language and you can see if its correct.
B
31
S
7
G
2
Posts: 159
Reputation: 3,739

Post » Wed Jun 12, 2013 3:09 pm

I found the problem. I have 3 layouts. In the first layout I've put the Dictionary object and set all instance variables through the property panel (thats the good way, right?).

When I display the KeyCount in the second layout, it gives 0. Looks like it forgets the instance variables in the second layout... How can I use the Dictionary throughout all my layouts?

edit: Global is set to On.clouddesign2013-06-12 15:14:20
B
4
Posts: 9
Reputation: 220

Post » Wed Jun 12, 2013 3:16 pm

No, you shouldnt use instance variables in the dictionary. Search in the tutorials how to use it, its very easy.

Add key "KeyName" with value "value" -> Thats how you see the line for adding entries to the dictionary in the eventsheetByR2013-06-12 15:16:56
B
31
S
7
G
2
Posts: 159
Reputation: 3,739

Post » Wed Jun 12, 2013 3:28 pm

It's working. Thanks for your help mate!
B
4
Posts: 9
Reputation: 220


Return to How do I....?

Who is online

Users browsing this forum: ivosb, Moordhuis, omnipaws, Youtopize and 5 guests