Exercise: Making a Menu
Translation Configuration
Open the Translation Editor by clicking Open Translation Editor… on the Toolbar or by clicking on Tools > Translation Editor. Create a total of 5 Keys; the index should be from 0-5. Key 0 will be named “Food 1”, and Key 1 will be named “Food 2”,Key 2 will be named “Food 3”, Key 3 will be named “Drink”, and the final Key, Key 4, will be just named “Water”.
Click on Edit Languages. Once in the Language Editor, rename “English” to “Breakfast”. After the renaming is done, click on the + two times to add two new languages. Change the second language name to “Lunch” and the third one to “Dinner.” Once renamed, click on OK to save the changes and leave the Language Editor.
First, enter Water in the Water row under Breakfast, Lunch, and Dinner. Under Breakfast, enter the following information: for Food 1, add “Sausages”; for Food 2, add “Bacon”; for Food 3, add “Pancakes”; for Drink, add “Coffee”. For Lunch: for Food 1, add “Hamburger”; for Food 2, add “Chicken Tenders”; for Food 3, add “Grilled Cheese”; for Drink, add “Strawberry Lemonade.” Under Dinner, for Food 1, add “Steak”; for Food 2, add “Lamb”; for Food 3, add “Spaghetti”; and Finally, for Drink, add “Iced Tea”.
Create eight Text Boxes. For each Text Box, have the following text in a different Text Box. Food 1, Food 2, Food 3, Drink, Water, Breakfast Menu, Lunch Menu, and Dinner Menu.
For The Text Box with Food 1, click on the Text Box, go under Basic Properties, and in the Text Field, Click on the Link Icon. Click Expression and change the Expression Type to Multilanguage String. Click OK to save the changes. Do this for Food 2, Food 3, Drink, and Water. For Breakfast Menu, Lunch Menu, and Dinner Menu, click on one of them, go under Actions > On Press > New Command. For each Text box, make a new Command that will Set Translation Language. The Lanuggae should be set to whatever the text says, so lunch will open Lunch, and dinner will open dinner.
Make sure the Initial Value on the Text is the exact same as the Translation Editor Key; otherwise, the Translations will not function
Translation Runtime
Click Tools >Launch Simulator to launch the Canvas Simulator.
Click on “Breakfast Menu.” This will cause all items in the middle column to change to their Translations from the Breakfast column in the Translation Editor.
Do this as well for Lunch and Dinner. The text will be translated to their respective translations that were listed within the Translation Editor.
0 Comments