Language translations in Unity

Daniel Kirwan
3 min readMay 26, 2021

Objective: Add in a Unity asset that allows for quick language localisation for a project

For my endless runner DangryRun I wanted the users to have the option to change the language of the text in the game. I came across a Unity asset called Lean Localisation.

It is a free asset and is has excellent documentation on how to use it in your project.

First you need to download and import the asset like any other. Then in the hierarchy right-click and select the Lean option and click localisation.

Once you have this asset, it is now time to create the translations you want.

In the LeanLocalisation game object, add in the languages that you wish to support.

Then we can start to add our keywords/sentences to the asset.

In the LeanLocalisation game object, check the translations section and type in your phase or keyword you’re going to translate. I will say this up front, this asset doesn’t auto translate the words or sentences for you. But it does allow you to change all text at once from one language to another.

Now click on the newly created game object named after whatever you entered into the translations box.

You will see options to create a language option and this is the area where you will need to enter the correct translations in each language.

Now you need to select the text object that you want to translate, for example I have a speed text object above some buttons, all of these objects have the following component on them for the Lean asset to work.

On the text object, add a component and select Lean Localised Text. Now you need to add in the keyword object from the list and also add in the fallback text that you wish to display.

In this project I have my language options tied to some buttons, so that whenever the player clicks the flag it will run the method associated with it. To make this work, add a click event to the button and drag in the Lean localisation asset into the click event. Then select the following method: LeanLocalisation.SetCurrentLanguage. This will allow you to pass in a string of the language you want to set all the text to.

And that is all the set up need for this asset to work and it works like a dream, the longest part of the set up is making sure the translations are all correct.

--

--