TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches
Terraria.Localization.Language Class Reference

Contains methods to access or retrieve localization values. The Localization Guideteaches more about localization. More...

+ Collaboration diagram for Terraria.Localization.Language:

Static Public Member Functions

static LocalizedText GetText (string key)
 Retrieves a LocalizedText object for a specified localization key. The actual text value can be retrieved from LocalizedText by accessing the P:Terraria.Localization.LocalizedText.Value property or by using the M:Terraria.Localization.Language.GetTextValue(System.String) method directly.

Using LocalizedText instead of string is prefered when the value is stored. If the user switches languages or if resource packs or mods change text, the LocalizedText will automatically receive the new value. In turn, mods using those LocalizedText will also start displaying the updated values.


 
static string GetTextValue (string key)
 Retrieves the text value for a specified localization key. The text returned will be for the currently selected language.
 
static string GetTextValue (string key, object arg0)
 
static string GetTextValue (string key, object arg0, object arg1)
 
static string GetTextValue (string key, object arg0, object arg1, object arg2)
 
static string GetTextValue (string key, params object[] args)
 
static string GetTextValueWith (string key, object obj)
 
static bool Exists (string key)
 Checks if a LocalizedText with the provided key has been registered or not. This can be used to avoid retrieving dummy values from M:Terraria.Localization.Language.GetText(System.String) and M:Terraria.Localization.Language.GetTextValue(System.String) and instead load a fallback value or do other logic. If the key should be created if it doesn't exist, M:Terraria.Localization.Language.GetOrRegister(System.String,System.Func<System.String>) can be used instead.

Note that modded keys will be registered during mod loading and M:Terraria.ModLoader.Mod.SetupContent is the earliest point where all keys should be registered with values loaded for the current language.
 
static int GetCategorySize (string key)
 
static LocalizedText[] FindAll (Regex regex)
 
static LocalizedText[] FindAll (LanguageSearchFilter filter)
 Finds all LocalizedText that satisfy the filter parameter. Typically used with M:Terraria.Lang.CreateDialogFilter(System.String) or M:Terraria.Lang.CreateDialogFilter(System.String,System.Object) as the filter argument to find all LocalizedText that have a specific key prefix and satisfy provided conditions.
 
static LocalizedText SelectRandom (LanguageSearchFilter filter, UnifiedRandom random=null)
 Selects a single random LocalizedText that satisfies the filter parameter. Typically used with M:Terraria.Lang.CreateDialogFilter(System.String) or M:Terraria.Lang.CreateDialogFilter(System.String,System.Object) as the filter argument to find a random LocalizedText that has a specific key prefix and satisfies the provided conditions.
 
static LocalizedText RandomFromCategory (string categoryName, UnifiedRandom random=null)
 
static LocalizedText GetOrRegister (string key, Func< string > makeDefaultValue=null)
 Returns a T:Terraria.Localization.LocalizedText for a given key.
If no existing localization exists for the key, it will be defined so it can be exported to a matching mod localization file.
 
static LocalizedText GetOrRegister (Mod mod, string key, Func< string > makeDefaultValue=null)
 

Properties

static GameCulture ActiveCulture [get]
 The language the game is currently using.
 

Detailed Description

Contains methods to access or retrieve localization values. The Localization Guide

teaches more about localization.

Definition at line 11 of file Language.cs.


The documentation for this class was generated from the following file: