If you have managed to muddle through making an app and getting it up on the Google console you may have noticed the tips and sections on adding different languages for store listings.
This should be possible by adding a localisation Manager and supporting scripts to your project.
Unity have a very good Tutorial on this and it is relatively straight forward. I found a tutorial on this area via DFT Games YouTube Channel.
The video goes on to show the concept of Localisation and how it is applied to websites. What we want is the core code to execute the language change.
Download the project from the link in the video description or from here.
The part we want to use is the “Localisation” which is in => UnityLocalization-master\Assets\DFT Games\Localization. (you will have to forgive the spelling as I had to stop myself from changing the “z” to an “s” !).
Extract the folder and import it (drag and drop) to your Unity Project.
I opened his “Demo” scene and copied the “MenuManager” object into my “MenuScreen” scene (changing the object name to “LocalisationManager”). Then opened the script attached to the “LocalisationMangaer” and tailored it like so:
public class MenuManager : MonoBehaviour
#region Language Selections
public void SetEnglish()
public void SetGerman()
public void SetFrench()
public void SetSpanish()
public void SetItalian()
public void SetPolish()
public void SetKorean()
public void SetJapan()
#endregion Language Selections
In the original script you would find an extra line for switching images on language change. I did not need this so removed all the references. Replacing it with my “SceneManager.LoadScene(“MenuScreen”);”
To note: I also removed the script which handles the Image switching – LocalizeImage.cs from the folder too.
I created the .txt documents inside the => Assets\Localization\Resources\Localisation folder. Naming them => English, French, German etc, etc.
Example of text inside file:
*(\n = newline/return)*
My dictionary would be the same for every language, so for the German.txt file it would be:
I next made sure the buttons for different languages i.e. Deutsche (German) had an On-Click event/Button component added to it. Then taking the LocalisationManager object – dropped this into the run-time inspector field. Select the MenuManager script from the dropdown and select the corresponding Language i.e. “SetGerman”.
Once this groundwork/prep has been done, you can now simply add the “Localize.cs” script to any text object.
The component will then display a field labelled – “Localized Key” in here you would put the first value on the left side of the equals sign from your Dictionary, i.e. “start” or “gameover” and so on and so forth.
Make sure to put the key exactly as you have created inside the .txt file/s. This relates to all the different language text files you have created.
Then if you have it setup as I have, the click of the button will then take you to the MenuScreen and show you correct language associated with the key value.
If you have any issues with the above – as always, please get in-touch!