String Modding

**Strings** are used to display text in-game. Most mods will need a large amount of strings for a variety of subjects such as the names and descriptions of factions, cities, scenarios, objectives or even the name and description of the mod itself.

While it is possible to open and modify the .str files containing the strings through a plain text editor, it is recommended to use the official Stringwrangler tool created by the game's developers instead.

## String Basics

### .str Files

Game strings are stored inside .str files.

The game will automatically load every .str file within the mod's 'Resources' folder and sub-folders thereof, so the exact placement and naming of the .str files themselves doesn't matter. Additionally, a mod can contain any amount of .str files, which in turn can contain any amount of strings. This means it is entirely up to the modder to decide how they want to structure their .str files.

The exception to this rule is a string file containing the name and description of the mod itself, which must be called cover.str and must be located directly inside the mod's main folder *outside* of the mod's Resources folder (see Modding General.)

### Strings

Each individual string contains any amount of text and has an internal name, which is used to refer to the string in the game's script or entity files. If two strings have the same name then one will be loaded over the other, even if they are in different .str files and even if the same string name is used in a different mod or vanilla. As such, care must be taken to ensure that each string name is unique, unless you are purposefully trying to override strings from vanilla or another mod.

There are different available types of strings to be used. The default 'Text' type will be sufficient for most purposes, but there are additional 'XML' and 'XML Fragment' types which support thse use of XML tags within the string content, which can be useful for formatting or for inserting dynamic content into the string in certain LUA scripts.

Strings may also contain TODO or Comment data, which isn't loaded in-game but can be used to keep notes on specific strings in Stringwrangler.

## Using Stringwrangler

### First Set-Up for New .str Files

To get started with Stringwrangler on a new file, it is first necessary to add a language for the strings.

Since the main game itself is only localized in English, it will generally only be necessary to add English as a language.

To do so, go to View->Languages->Add New Language, type 'en' (without quotes) in the input dialog, and press OK.

This will give each string in the file an 'en source' box where you can enter the text content that will appear in-game for this string in the English language.

### Adding Strings

To add a string, go to Edit->Add String.

Type the name of the string in the input dialog. The name of the string must not contain any spaces. Then press ok in the input dialog to add it. It should now appear in the list of all strings in this .str file (on the left side of Stringwrangler's UI) and should be automatically selected for editing.

The actual text content of the string can then be typed in the 'en source' text field on the right. The string's data type (Text, XML, or XML Fragment) can be changed in the Data Type dropdown in the bottom right. Notes for Comments or TODO can be typed in the text fields near the bottom as well.

The 'en preview' box just shows a preview of the string which can be useful to test any XML that is in the string, if it is of the XML or XML Fragment data type.

### Editing/Deleting Strings

Strings inside a .str file can be selected by clicking on their name in the list of all strings inside this .str file which appears on the left side of Stringwrangler's UI.

From there, the string's main text content as well as its data type and comments or TODO information can be edited as usual.

The string can be renamed or deleted by going to Edit->Delete String or Edit->Rename String respectively.

## Other References

For a guide how to create your own localization / translation of the game, see here.