Localize Your Settings
Every localization key Gears asks your mod for, where you declare each one, and what the player sees when a key is missing.
Every piece of text Gears shows for your mod comes from a key in your mod's
Config/Localization.csv, which Gears reads through the game's Localization.Get. Gears ships no
text for your settings. Use this page to work out which keys you need to supply.
What happens when a key is missing
Localization.Get returns the key itself when it has no translation, so a missing key shows in the
menu as raw text such as myModHudScale. It never shows as a blank.
That makes a typo easy to spot while you play. It also means a displayKey that happens to read as
English "works" with no row in the CSV file. Write a real key anyway, so that someone can translate
the text later.
Keys Gears looks up
| Where you write it | Key Gears uses | If it is empty or absent |
|---|---|---|
<Tab displayKey=""> | that key | falls back to the tab's name, which Gears also looks up as a key |
<Tab tooltipKey=""> | that key | no tooltip |
<Category displayKey=""> | that key | falls back to name |
<Selector/Slider/Switch/Color/Binding displayKey=""> | that key | falls back to name |
<Caption key=""> on a setting or category | that key | falls back to the display name |
<Description key=""> on a setting or category | that key | nothing is shown |
<LocalizationPrefix prefix="P"> on a Selector | P plus each allowed value, and P plus the current and selected value | the value itself is looked up as a key |
<LocalizationPrefix prefix="P"> on a Switch | P plus the left value, P plus the right value, and P plus the current and selected value | the value itself is looked up as a key |
Without a prefix, Gears still passes each value to Localization.Get. Usually no key matches, so
the raw value is shown. If a value happens to match a key that the game or another mod defines, the
player sees that key's text instead. Add a prefix to be sure the value shows as you wrote it, or as
you localized it.
Gears joins the prefix to the value with no separator. Put any separator you want inside the
prefix itself, such as prefix="myModUnits_".
On a Selector, the value that Gears prefixes is the value after the ui formatter has run. With
<Formatter ui="000"> and a prefix of q, the value 7 looks up q007.
Settings you create from C# use the same lookups. DisplayKey, CaptionKey, DescriptionKey and
LocalizationPrefix on the setting objects are the same strings.
Worked example
This Selector:
<Selector name="Units" displayKey="myModUnits" type="string" defaultValue="metric">
<List allowedValues="metric,imperial" />
<LocalizationPrefix prefix="myModUnits_" />
<Caption key="myModUnitsCaption" />
<Description key="myModUnitsDesc" />
</Selector>needs these five rows:
Key,File,Type,UsedInMainMenu,NoTranslate,english
myModUnits,UI,Menu,x,,Units
myModUnitsCaption,UI,Menu,x,,Unit system
myModUnitsDesc,UI,Menu,x,,Which unit system the heads-up display uses.
myModUnits_metric,UI,Menu,x,,Metric
myModUnits_imperial,UI,Menu,x,,ImperialMark UsedInMainMenu with an x on every row. The Mods menu opens from the main menu, before a
world is loaded, and the game does not make rows without that mark available there.
Keys that belong to Gears
Gears localizes the Mods window itself — the buttons, headers, Enabled and Disabled labels, and sort
options — from its own Localization.csv. You do not need to supply any of those keys. Gears
reserves every key beginning gears, so do not start your own keys with it.
ModSettings.xml Reference
The complete V2 schema for ModSettings.xml as the parser reads it — every element, every attribute, and what happens when something is wrong.
Read Settings in XML Patches
Call modsetting() to read your own or another mod's settings from a conditional block or inline in an attribute value.