Skip to content

Modding: Translations

ErinaSugino edited this page May 31, 2023 · 1 revision

This guide aims to teach people interested in creating translations for SBR through the process of doing so in a non-intrusive way. While this guide was written with detailed explanations, basic modding knowledge is expected. If you are completely new and have no idea what we'Re talking about, please first read up upon the structure of Starbound mods and how to create .patch files.

This guide was created with the help of Mahorych00, who in the past already created the Russian translation for the original mod.

Please do take this task serious and do not rely on Google Translate (or other machine translation services), as this will ultimately only result in a lesser experience than not translating at all.

The Necessities

In order to properly add or change anything in Starbound you need to create a new mod. This ensures that files are loaded in the right order, as well as gives users easy control over what to remove in order to "deinstall" a certain mod.

Do so by creating a new folder named in a way that is easily recognizable. The name of this folder doesn't really matter to the game, it just tells the user what to expect inside. The important part is creating the _metadata file inside, which is the heart and soul of anything recognized as "mod". The file has to be named exactly like this - it has no file ending. Nonetheless you can still open it with your OS' default text editor or text editing program of choice.

Inside the _metadata file you fill out your mod information, like this example:

{
  "version" : "2.1.1", //any number you decide - recommended the version of SBR this translation is for//
  "author" : "Locuturus & Mahorych00", //whoever you decide to list as authors//
  "name" : "sexbound_ls_russian", //the name that your mod will be seen as by the game itself. Must be unique or it overrides other mods//
  "description" : "Installs and enables support for the Russian language.\n\nCredits:\n\nMahorych00", //self-explanatory//
  "friendlyName" : "[SxB] Language Support (Russian)", //how the users will see the mod in-game//
  "link" : "", //optional - link to whereever you publish your mod; you can edit the _metadata file later//
  "priority" : -68, //set to -68 or higher to ensure it loads AFTER the main mod//
  "requires" : ["lox_sexbound"] //leave this be; ensures that the mod only works if the main mod is installed//
}

Fill in your own information accordingly and removed all the //comments//. Don't publish placeholders, it will break things or atleast look very stupid while trouble shooting; yes, I have seen this before.

The Translation

After your translation mod is properly set up, it's time to do the actual work. First, grab a copy of the current dialog files from the newest SBR version. All the currently relevant files are located in the following directory:
image

Copy that folder. Recreate the structure in your own mod folder by creating a dialog, sexbound folder and finally paste the en folder into there. Then, rename en to the language code of whatever language you want to translate to. Now you can start editing the files.

Notifications

The notifications.config file contains all system notifications that will be sent via radio messages, i.e. S.A.I.L. opening a Visual Novel style dialog box slowly typing the text. These events are notifications of certain in-mod events and come in multiple variants based on the user's notification settings.

Keep in mind that all editable files from here on out can be opened like normal textfiles and contain JSON, so make sure to validate your code before publication, otherwise things will crash. If you don't know the syntax of JSON, make sure to read up on that!

Most parameter names should be self-explanatory, otherwise the English dialog should give away what it corresponds to.
Named object chunks (denoted by being in curly brackets "name": { ... }) just have the dialog inside.
Named list chunks (denoted by being in square brackets "named": [ ... ]) have multiple immersive variants. In these cases, the first chunk is for the detailed version, which doesn't withhold information and explains everything in debug-level detail. The second chunk is for the immersive version of the notifications, whereas information is stripped down to only give a vague hint at what's happening, no details.
If the dialog contains placeholders (denoted in < ... >), currently only present in birth notifications, these exact placeholders are available in translations too. Keep in mind that the values of these placeholder can currently not be translated.

Positions

The positions folder - and its corresponding sub-folder - contain the sextalk dialog for all supported species for every position. The exact structure of sextalk dialog files is irrelevant for the prospect of mere translation, however should you want to also add new dialog of your own you should read through the corresponding guide. Keep in mind that the structure of sextalk dialog will greatly change in future versions of SBR.

Applying the changes

Now that you have added the translated files to the mod, it is time to properly add the new language to be recognized by the mod.

For this, you need to patch into the main sexbound.config file. Again, if you have no idea what I am talking about, please first read up on how .patch files work. Good news is, messing up this part doesn't crash the game, it simply renders your content useless.

The path you are patching into is sex/supportedLanguages/<yourLanguage>, and you'll need to add a new object containing the following information:

{
  "title": "<human readable name>",
  "name": "<internal name>",
  "languageCode": "<language code>"
}

The internal name usually is the same as the <yourLanguage> parameter name, and the language code needs to be the one you named your translated folder as. In case something went wrong, SBR will just revert back to English.

Now, all that's left is for the player to set the defaultLanguage setting in the same config file to the internal name of your new language, and BAM - sexbound is translated (for most of the part)! Please don't override the defaultLanguage setting via a patch but instead explain to your users how to change their config themselves.

Translating - Advanced

With the notifications and sextalk dialog translated, most of the relevant parts of the mod are done. However, in case you want to fully translate the entire "mod" you might be wondering "But what about item names, descriptions and stuff?". Good question; the answer is "Are you sure you want that?"

This is where stuff gets tricky. Starbound has no means to dynamically load translated data for items and co. The reason everything so far was as simple as copying and editing a .config file is, because all of this has been purely modded content that is fully loaded and managed at SBR's discretion. Items and objects, however, are vanilly Starbound territory. The only way to get dynamic content loading on this would require performance tanking scripts to be attached to every single one of them, loading a config then changing the item in your inventory after it was already created.

So, in order to translate item and object names and descriptions, the only sane way is patching. For every single item and every single object in SBR, you'd need to create a corresponding .patch file replacing the content of the shortDescription, description, as well as (if present) the respective <racename>Description for every supported race. Not only is this a highly tedious task, it is also error prone when other mods alter this as well, and most importantly a persistent forced change. Opposite to the translated dialog which users can turn on or off in their config, for as long as your mod is installed these will be forever translated. So if you still want to go to such lengths, make sure to properly inform and educate your users on how to deal with this.

Requests & Trouble Shooting

Found something that you think needs translation support? Something not working as intended? Something unclear in the guide? You can always create an Issue and bring it up!