Home

Awesome

UnityLocalizationManager

Localization system to manage multiple languages including date time, currencies, and other informations that change depending on current language.

How to use

you can find a pratical example inside this repository in PoolingScene scene

1 - Exporta a CSV file with all the languages and translations (use this file as base)

2 - Place the file wherever you want in the project and change the path in LocalizationManager constructor

public LocalizationManager(string filePath = "PATH/TO/FILE.CSV")
{

3 - The project will initially use the system language as default. If you wish to change, use LocalizationManager.Instance.ChangeLanguage using the language code or Locale (you can find/add Locales in Locale.cs

LocalizationManager.Instance.ChangeLanguage("en_US");

4 - To get a localized text, use LocalizationManager.Instance.Get. You can also use parameters (explained below)

LocalizationManager.Instance.ChangeLanguage("es_ES");
var localizedHello = LocalizationManager.Instance.Get("hello"); //will return Hola

5 - To use dynamic values with localized text, use the LocalizationManager.PARAMETER_DELIMITER between a key and call Getwith the respective dictionary.

//Example of a localized text with parameter
//playerPoints = You have @points@ points!
var pp = 10; 
var localizedPoints = LocalizationManager.Instance.Get("playerPoints", new Dictionary<string, string>() {{"points", pp.ToString()}});//will return You have 10 points!

LocalizationManager public overview

Properties

nametypedescription
CurrentLocaleLocaleThe current Locale being use to gather the translations.
onLocalizationChangedUnityEventCallback triggered when language is changed (usefull to change text/sprites that is already on screen)

Methods

</br>

LocalizationManager.ChangeReferenceFile

nametypedescription
filePathstringPath to the file.
</br>

LocalizationManager.ResetLanguageToDeviceLanguage

</br>

LocalizationManager.ChangeLanguage

nametypedescription
codestringISO language and country code. Previous registered in Locale
</br>

LocalizationManager.ChangeLanguage

nametypedescription
localeLocaleThe locale to be change
</br>

LocationManager.Exists

nametypedescription
keystringKey to compare
</br>

LocationManager.Get

nametypedescription
keystringKey to compare
replacesDictionary< string, string >Replaces texts that are between PARAMETER_DELIMITER character and replace with the value
</br>

LocationManager.FormatDate

nametypedescription
dtDateTimeDate to be formated
</br>

LocationManager.FormatTime

nametypedescription
dtDateTimeTime to be formated
</br>

LocationManager.FormatCurrency

nametypedescription
valueDoubleValue to be formated
</br>

LocationManager.FormatNumber

nametypedescription
valueDoubleValue to be formated
decimalsintValue to be formated
</br>

LocationManager.FormatPercent

nametypedescription
valueDoubleValue to be formated
percentValueDoubleValue to be formated
</br>

LocationManager.ParseToFloat

nametypedescription
strstringValue to be parsed
</br>

LocationManager.ParseToInt

nametypedescription
strstringValue to be parsed

Future releases