A Unity Package to enable multiple languages in your game
namespace JelleVer.Localisation
This can be imported as a UnityPackage in any existing Unity project through the Package manager with the Git url.
You can find the full documentation here: jellevermandere.github.io/Localisation
Using this package is pretty straightforward.
You need a localisation.csv
file in your Resources
folder according to this layout:
"key","EN","NL",...
"ID_Example_1","valueEN1","valueNL1",...
"ID_Example_2","valueEN2","valueNL2",...
...
You can freely add any number of languages, the system will automatically detect all the languages.
Each Text of TMP_Text object you then want to have translated needs a TextLocaliser
component, where the text value in the component will be used to find the correct translation in the .csv.
Once the level starts, the value will be updated. You can also update the value at runtime using:
public void UpdateText(string key = ""){ }
If you want to switch to a different language, you can do so using the LanguageSwitcher
with the function:
public void ChangeLanguage(){ }
This toggles the current language to the next one in the list and updates all the active TextLocaliser
objects.
The code in this project is licensed under MIT license.