Skip to content

Instantly share code, notes, and snippets.

@enenra
Last active May 5, 2021 13:43
Show Gist options
  • Save enenra/d5cdfbd775739b7e3f3927f7cb844239 to your computer and use it in GitHub Desktop.
Save enenra/d5cdfbd775739b7e3f3927f7cb844239 to your computer and use it in GitHub Desktop.
Tutorial: Using SE's Localization Features in Mods

Tutorial: Using SE's Localization Features in Mods

This tutorial covers the setup of localization files for your mods, which will enable you to move all your text out of your SBC definitions. This is good practice but more importantly also allows you to include translations of your mod within the mod itself - without a need to create and maintain a second mod.



Required Tools

Setup

Download the empty MyTexts.resx and the MyTexts.sbl file. Place them as follows:

[YOURMOD]\Data\Localization\MyTexts.resx
[YOURMOD]\Data\Localization\MyTexts.sbl

Next, open MyTexts.resx and you should see something like this:

Within your SBC's DisplayName or Description-tags, you can now place any string as a variable to connect it to a text bit saved within the RESX-file. This is done by wrapping the string into {LOC: and }:

<DisplayName>{LOC:My_Cool_String}</DisplayName>

Now add that same string to the Name-column in the MyTexts.resx-file. Place the text you want to show ingame into the Value-column:

My_Cool_String | My Block Name

Translations

In order to include translations in your mod, add a correctly named MyTexts-files for the respective language in your mod:

Also add the corresponding SBL-file for the language to your mod.

Ensure that the Name-column always stays the same, but replace the strings within the Value-column with the translation of the string in the respective language. When a player selects a certain language ingame, the correct translations should immediately be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment