Structs:StringTable
Jump to navigation
Jump to search
The StringTable struct interacts with string tables that are set up with the LANGUAGE lump.
Methods
Static
- native String Localize(String val, bool prefixed = true)
- Localizes the provided string
val
. - If
prefixed
is true, the code assumes that the$
character is already a part of the string (such as "$PICKUP_PISTOL_DROPPED"). If it's set to false, the$
character will be added into the string. Leave it at true if you don't know beforehand if the string you're localizing is an explicit string or a LANGUAGE reference.
Examples
This will pull the localized version of the Pistol's PickupMessage ("Picked up a Pistol" in English):
Console.PrintF(StringTable.Localize("$PICKUP_PISTOL_DROPPED");
This PickupMessage override, when inserted into an Inventory item, will print a formatted string, consisting of the item's regular PickupMessage, followed by an amount picked up in parentheses. For example, in case of a Clip, this would print: "Picked up a Clip (+10)":
override string PickupMessage()
{
return String.Format("%s (+%d)", StringTable.Localize(pickupMsg), amount);
}