Localization

From Space Engineers Wiki
Jump to navigation Jump to search
Beginner
Learnings

How to add localization texts to your mod.

How to install the required applications.

Prerequisites

Completed setting up a modding environment for SBC modding.

Overview

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 version of the mod.

There currently is an issue with Keen’s RESX-Implementation for mods: If you have the modded block on your toolbar, then save and reload the save, you will see its localization key instead of the localized name. Unfortunately there isn’t much that can be done about this right now. Keen is aware of the problem but has not gotten around to fixing the bug yet.
The alternative is to use SISK's script to load the .resx (remove the .sbl file if you use the script)

Setup

Step 1: Download and place the files.

Download the MyTexts.resx and MyTexts.sbl files (top-right download icon) and place them as follows:

[YOURMOD]\Data\Localization\MyTexts.resx
[YOURMOD]\Data\Localization\MyTexts.sbl
Step 2: Open MyTexts.resx

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


Localization tutorial.png
Step 3: Place references in SBCs
Within your SBC's DisplayName or Description-tags, you can now place any string as a variable (preceded by DisplayName_ or Description_ respectively) to connect it to a text bit saved within the RESX-file. This is done by wrapping the string into {LOC: and }:
<DisplayName>{LOC:DisplayName_MyCoolString}</DisplayName>
<Description>{LOC:Description_MyCoolString}</Description>
Step 4: Assign text to the references in RESX
Now click New Resource and 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:
DisplayName_MyCoolString | My Block Name
Description_MyCoolString | My Block Description
The vanilla game does not need the {LOC: ... }-wrap around the RESX reference. Only mods do.

Translations

Step 1: Add corresponding language file
Localization tutorial 1.png

In order to include translations in your mod, add MyTexts. followed by the language code and then by the .resx extension.

MyTexts.resx is the default loaded for all languages, then the specific suffixed one is loaded for that language to override the entries in it. Since the default should be english, there's no point in doing MyTexts.en.resx too.

For example, if you want to add translations for Icelandic, create MyTexts.is-IS.resx.

  • Code - Visual name (Internal name)
  • en - English (English)
  • cs-CZ - Česky (Czech)
  • sk-SK - Slovenčina (Slovak)
  • de - Deutsch (German)
  • ru - Русский (Russian)
  • es - Español (España) (Spanish_Spain)
  • fr - Français (French)
  • it - Italiano (Italian)
  • da - Dansk (Danish)
  • nl - Nederlands (Dutch)
  • is-IS - Íslenska (Icelandic)
  • pl-PL - Polski (Polish)
  • fi - Suomi (Finnish)
  • hu-HU - Magyar (Hungarian)
  • pt-BR - Português (Brasileiro) (Portuguese_Brazil)
  • et-EE - Eesti (Estonian)
  • no - Norsk (Norwegian)
  • es-419 - Español (Latinoamerica) (Spanish_HispanicAmerica)
  • sv - Svenska (Swedish)
  • ca-AD - Català (Catalan)
  • hr-HR - Hrvatski (Croatian)
  • ro - Română (Romanian)
  • uk - Українська (Ukrainian)
  • tr-TR - Türkçe (Turkish)
  • lv - Latviešu (Latvian)
  • zh-CN - Chinese (ChineseChina)
Step 2: Add corresponding SBL file
Also add the corresponding SBL-file for the language to your mod.
Step 3: Fill in the translations
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.