Fan Translating Monster Train 2 - Monster-Train-2-Modding-Group/Trainworks-Reloaded GitHub Wiki

Fan Translating the Game

Note that not all languages can be imported into the game so mileage may vary, it may be beneficial to pick a key and put your languages entire alphabet into it to see what characters don't display correctly. if there are some unsupported characters then a font with the characters will have to be added.

Setup

  1. Set up Trainworks reloaded from thunderstore
  2. Run the game at least once to generate the configuration
  3. Edit the Trainworks Reloaded configuration Tools > Generate CSVs to true
  4. Run the game and collect 0_Default.csv and 1_Default.csv in the mods folder
  5. Edit the Trainworks Reloaded configuration Tools > Generate CSVs to false
  6. Open 0_Default.csv and 1_Default.csv Remove the following columns: Type, Desc, Group, Descriptions, and each column after English [en-US]
  7. Only two columns should remain after step 6) Key and English [en-US]
  8. Rename the English [en-US] column to your new language

Translating the text

The following things should NOT be translated.

  1. Do not edit any text enclosed in []'s ex. [rage], [effect0.status0.power].
  2. Do not edit anything in HTML tags ex: these are also not meant to be translated and are replaced.
  3. Do not edit any text enclosed in {}

These are replaced when the game queries said text. [rage] will be replaced with another localization key specified by ReplacementStringsData and then localized.

Importing or testing your translations

  1. You will need to setup a Trainworks Reloaded mod using our Mod Template Guide: https://github.com/Monster-Train-2-Modding-Group/Trainworks-Reloaded/wiki
  2. Once that is setup you will need to add code to the Plugin's Awake method (replace <LANGUAGE_NAME> with your language ex. "Polish")
            LocalizationManager.InitializeIfNeeded();
            for (int i = 0; i < LocalizationManager.Sources.Count; i++)
            {
                var source = LocalizationManager.Sources[i];
                source.AddLanguage(<LANGUAGE_NAME>);
            }
  1. Delete global.json and replace the similar looking section of code in Plugin.cs to
	c.AddJsonFile(
		"json/plugin.json"
	);

(from c.AddMergedJsonFile(...)) 4) json/plugin.json contents should be the following. Replace <LANGUAGE_NAME> with the langauge name from Step 2 above it must match exactly <LANGUAGE_CODE> is the code for the language in order to get the text for the Settings screen. Ex. Polish has language code pl. If you don't know leave it blank and when you open the settings screen later the game will tell you. Optimally for texts section you should provide the language name in all of the current supported languages.

{
  "language_sources": [
    {
      "language": <LANGUAGE_NAME>,
      "csv_paths": [
        "csv/0_Default.csv",
        "csv/1_Default.csv"
      ]
    }
  ],
  "localization_terms": [
    {
      "key": "LanguageName_<LANGUAGECODE>",
      "texts": {
        "english": "Language Name In English"
      }
    }
  ]
}
  1. Create folder csv/ under the project directory and Copy 0_Default.csv and 1_Default.csv into it. Make sure that Visual Studio is setup to copy the contents of this directory to the build directory. (Add the following under the ItemGroup tag in the csproj file)
    <None Update="csv/*">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
  1. Once setup you can build the project and then copy the built files to the BepinEx plugins directory

  2. Run the game and go to the Settings Dialog in the other tab your language should be listed. If you didn't set the localization for the language then the game should say LanguageName_<code> so if you hadn't done that replace the key in the localization_texts section of the json to this.

  3. To speed up translating text you can use other mods to be able to view the full logbook (Dev consoles or Open Sesame)

  4. Once done and happy with the translation follow the release process in https://github.com/Monster-Train-2-Modding-Group/Trainworks-Reloaded/wiki

⚠️ **GitHub.com Fallback** ⚠️