Skip to content

About

A Xenonauts 2 mod that adds custom translation strings without replacing the game’s original localization files. Before the translation table is parsed, the mod merges rows from your CSV files into the text the game already loaded from its own *.csv files.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

X2-Runtime-Localization

A Xenonauts 2 mod that adds custom translation strings without replacing the game’s original localization files.
Before the translation table is parsed, the mod merges rows from your CSV files into the text the game already loaded from its own *.csv files.


How it works (short)

  1. The mod hooks when the game parses the next localization CSV.
  2. From that file it determines the language code (e.g. ru-RU, en-US).
  3. It compares that code to its own file at %mod_folder%/locale/<code>.csv.
  4. If they match, it appends the mod’s rows to the text before parsing; if there is no mod file for that language, it does nothing for that pass.

Every language file the game loads is processed this way: only locales for which your mod has a matching CSV are merged.

The mod itself does not add new lines to the game, it is only needed so that other modders can add their own translations.


Setup

  1. Place the built X2-Runtime-Localization.dll in %mod_folder%/assembly/common/.

  2. GUIDs for translations must match the LocalizableGUID block in the JSON asset (name and description use different GUIDs). Example:

{
  "$content": [
    {
      "GUID": "5835459a-3694-43b9-b2d1-cf0b4f89ab41",
      "TargetComponent": "Common.Components.NameComponent",
      "Request": "Translate"
    },
    {
      "GUID": "09b7dc44-1fea-4015-a979-db7c8fd461ee",
      "TargetComponent": "Common.Components.DescriptionComponent",
      "Request": "Translate"
    }
  ],
  "$t": "LocalizableGUID"
}
  1. Mod translation files go in %mod_folder%/locale/, with the same names as in the game: en-US.csv, ru-RU.csv, etc.
    Row format matches the game (see the originals), for example:

    Xenonauts2\Assets\Assets\xenonauts\data\common\localization\locales\en-US.csv

    At minimum: a header row and data rows with columns GUID, Key, Text, Translation.

  2. Launch — enable the mod in the launcher and start the game.

Optional: on first launch the mod creates a DEBUG_FALSE file in %mod_folder%/locale_mode/. To enable debug logging, rename it to DEBUG_TRUE. When debug is on, messages are written both to the normal game log (if logging is enabled there) and to %mod_folder%/locale_mode/logs/ (file runtime_localization.log).


Feedback

The code was written quickly and has not been properly tested. Comments, bugs, and suggestions are welcome on GitHub or Discord.

About

A Xenonauts 2 mod that adds custom translation strings without replacing the game’s original localization files. Before the translation table is parsed, the mod merges rows from your CSV files into the text the game already loaded from its own *.csv files.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages