3) Our first layour is going to be an intro Layout, so lets rename it to intro.
4) We need a text object on our layout so lets create it and drop it on our Intro Layout.
5) Lets create and instance variable on our Text Object to use as reference name of what is going to show. In this case I am using: language_reference as instance name and "welcome" as initial value.
6) We need to setup a default language for our project, to store this value I am using a global variable, so lets create it:
7) Lets fill our file with some data, here is mine:
8) Lets load our file using Ajax and on loaded lets parse it to the Json Object:
We already have a structure that could work using directly Ajax and Json but to let the Json object free for others purposes lets store our data on a Dictionary.
9) Lets use some fors to convert our Json into dictionary entries:
Lets run it on debug mode and see if the dictionary is receiving the keys correctly, if yes you should see the follow:
Now that we already have our dictionary, we need to fill our text object.
10) Lets create and action that is going to pick all text objects and fill it by Layout Name + language_reference variable + default language variable.
Now you can test it, the first layout will show Welcome on your text object.
To change the language simple change the default_language variable on your project and call the same action on item 10. Thats it.
Here is the entire event sheet:
Thanks.