LocalizationController

Stores the loaded localization and is used to access it.

Visibility: public static.

Assembly: "AD_LocalizationCore".

Namespace: "DGGLocalization".

Properties

static Language[] Languages - the languages in use.

Events

static event Action<Language> OnLanguageSwitch - triggered when the current language is changed.

Methods

Initialization

static void AddLocalization(Localization localization)

Allows adding a new localization. If duplicates are found with already loaded data, they will be ignored. Use only for runtime mode.

Localization

static LocalizationData GetLocalization(string localizationCode)

Returns the localization data with the same key provided as localizationCode. If nothing is found, it returns null.

static LanguageData GetCurrentLocalization(string localizationCode)

Returns the translation for the current language with the same key provided as localizationCode. If the key is not found, it returns an empty element with the translation "Localization is null!".

Languages

static void SwitchLanguage(int index)

Changes the current language. index is the language index, depending on the loading order.

static void SwitchLanguage(string code)

Changes the current language. code is the language identifier.

static Language GetCurrentLanguage()

Returns the current language.

static int GetCurrentLanguageIndex()

Returns the index of the current language.

static Language GetLanguageByCode(string code)

Returns the language with the identifier provided as code. If not found, it returns null.

Last updated