Class Localization
A class that houses the currently loaded language as well as allows for switching the currently selected language
Inheritance
Inherited Members
Namespace: TinyLife
Assembly: Tiny Life.dll
Syntax
public static class Localization
Fields
LanguageNames
A list of the full names of all of the languages that the game supports
Declaration
public static readonly Dictionary<string, string> LanguageNames
Field Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.String> |
Names
A dictionary that maps a key to all of the names matching the specified key. By default, this dictionary contains "FirstNames" and "LastNames", which are the randomly generated names for people, and "ModNames", which are the default names for the ModGame action.
Declaration
public static readonly Dictionary<string, string[]> Names
Field Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.String[]> |
Methods
Get(LnCategory, String)
Gets a localized string in the given category with the given key. If the localization is not found, the key, surrounded by question marks, is returned instead.
Declaration
public static string Get(LnCategory category, string key)
Parameters
Type | Name | Description |
---|---|---|
LnCategory | category | The category that contains the localization |
System.String | key | The key to localize |
Returns
Type | Description |
---|---|
System.String | The localization of the key |
Get(LnCategory, String, Object[])
Gets a localized string in the given category with the given key. If the localization is not found, the key, surrounded by question marks, is returned instead.
Declaration
public static string Get(LnCategory category, string key, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
LnCategory | category | The category that contains the localization |
System.String | key | The key to localize |
System.Object[] | args | An optional set of arguments that are passed to System.String.Format(System.IFormatProvider,System.String,System.Object) |
Returns
Type | Description |
---|---|
System.String | The localization of the key |
GetKeys(LnCategory)
Returns all of the keys that are registered for localization for a given LnCategory
Declaration
public static IEnumerable<string> GetKeys(LnCategory category)
Parameters
Type | Name | Description |
---|---|---|
LnCategory | category | The localization category |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> | A set of keys |
SetLanguage(String)
Switches the current language to the language given. Note that, for most ui elements to update, they have to be re-created.
Declaration
public static void SetLanguage(string language)
Parameters
Type | Name | Description |
---|---|---|
System.String | language | The code of the language to set |