Using WinZO’s SDK
Localisation for Static Text:
Static text means the text that does not change at runtime. Eg. Time, score, points, menu etc. In this approach, WinZO’s SDK will handle the localisation part for your game. You just need to follow some simple predefined steps.
Steps:
Wherever you are using a Text or TextMeshPro component in your game UI, you need to add the “LocalizedText” component via Inspector or script in the Awake() method of your script also and need to define a key for the same. This key must be unique for all of your text. This “LocalizedText” script is present in the WinZO’s sample SDK. You do not need to include “LocalizedText” script in your Unity package when you are exporting the package to be submitted.
For Example: Assign a key if you are adding “LocalizedText” component via script.
Add Key and its translated value in that particular json file. For Hindi and Portuguese, localizedText_hi.json and localizedText_po.json are already present in the sample project. Note: (i) Key must be the same in all languages and must be the same as you assign in LocalisedText during adding the component to your Text. (ii) This key must be in this format: "gamename_key" where gamename should be same as your game name and key can be any string. For Example: For Hindi Language: Add key and value in below file
For Portuguese Language: Add key and value in below file
Run Time Localisation
Run Time Localisation of a text means the value of the text will change at runtime.
Create a (GameName+Strings.cs) class within your namespace and add all the Text strings of your game along with their key. Eg. MetroSurferStrings.cs For Example:
The first parameter is the Original English translation string and the second is the key.
If you are playing the game in English language and have not set up the text value in Game UI then we fill the text from this variable using this key. In English language it will take the value from this key and if we are using other languages then it will take the key from here and search the value of that key in its perspective json file.
2. We have 2 json files (LocalizedText_hi.json and LocalizedText_po.json). Add a key value pair in this file, remember to use the same key and write its value in the specific language.
Example: In LocalizedText_hi.json
In LocalizedText_po.json
You have set up the localisation of your game now lets see how you can use this in your game. Go to your script where you are using the text. Get the localized value by using the above key and assign that value to your text.
Note: If you want to localize the text and append a number to the text, you can use the format only option available in LocalizedText script.
Example:
Last updated