localizationmanager

LocalizationManager

LocalizationManager is your intrerface to the localization services in hard times. You should use it to ensure that strings and labels you are going to display in game will eb localized to the active language selected by the user. If localization manager can't find a label it will fallback on the default language (English). If a given label can't be found even in the english localization it will just display the label as is.


Contains a reference to the singleton instance. You can use it to call methods on the global object from any script:

if(LocalizationManager.instance.IsReady)

The complete big huge dictionary containing any single label and value for the currently active language.

Contains the ready state of the manager. Will be set to true by the engine when language loading is complete.


Returns a List<string> object containing all the available languages that can be selected.

Switches the active language to the one given as a string parameter. Must match one of the available languages returned from GetAvailableLanguages().

LocalizationManager.instance.ChangeLanguage("Italiano");

Basically this is the same of the static method GLV.


This function should be called only by the internal engine. It's used to refresh all the LocalizedText elements in the scene, when language has been changed.

This static method is used to obtain a localized string from a label. It accepts a second optional parameter with a list of strings to use it as parameters in the resulting localized text

//returns the localized text assigned to the "My Label" label.
LocalizationManager.GLV("My Label"); 

// returns the localized text using the given parameters
LocalizationManager.GLV("My Label", new List<string>(){"first param", "second param"});

In the corrisponding json lang file there should be something like this:

{
  "key": "My Label",
  "value": "This label accepts two parameters: {?} and {?}"
},

The {?} tag will be converted to the parameter value in the same occurring order.

You could leave a comment if you were logged in.
  • localizationmanager.txt
  • Last modified: 2019/11/01 04:22
  • by thorfinio