I18nService API
The I18nService
class is responsible for managing internationalization (i18n) in the application. It handles language settings, loading translations, and replacing translation placeholders.
Method | Parameters | Returns | Description |
SetLanguage | Language | Changes the current display language. | |
GetLanguage | Language | Gets the current display language. | |
GetLanguageAsset | Language | LanguageAsset | Given a language identifier it returns the corresponding language asset from loaded translation files. |
GetI18nTextSubscriptionsHandler | I18nTextSubscriptionsHandler | Gets the current I18nTextSubscriptionsHandler instance. | |
AssetsHaveBeenLoaded | bool | Returns wether i18n translation files have been loaded or not. | |
SceneAssetsHaveBeenLoaded | bool | Returns wether i18n scene translations have been loaded. | |
SceneManagerHasBeenLoaded | bool | Returns wether the i18n scene manager has been loaded in the scene. | |
LoadTranslations | TranslationSets[] | Given an array of TranslationSets it replaces in-memory translations with the provided array. | |
Translate |
| string | Given a translation path and a translation set it searches in the translation set for the translation corresponding to the path. If a translation is found, it tries to replace defined variables with those passed as a Dictionary (dictionary key is variable, and value is the variable value). It returns a string representing the translated and replaced value. |
ReplaceTranslationPlaceholders |
| string | Given a translated string that can contain replacement variables, it returns it with variables replaced with the values from the dictionary. |
GetGlobalReplacements |
| It returns the global replacements dictionary. | |
SetGlobalReplacement |
| Given a replacement key and a value, it adds it to the global replacements. | |
RemoveGlobalReplacement |
| Given a replacement key, it removes it. | |
ClearGlobalReplacements | Removes all global replacements. | ||
AppendGlobalReplacements | Appends a dictionary to the current global replacements. |