Slime Rancher
0 of 0

File information

Last updated

Original upload

Created by

MegaPiggy

Uploaded by

MegaPiggy

Virus scan

Safe to use

About this mod

This is NOT a mod.
This is a utility that will be used by mods to add translations of in-game text for all supported languages.

Requirements
Permissions and credits
Donations
This is NOT a mod.
This is a utility that will be used by mods to add translations for all supported languages to their mods.


To use this API while creating your mod, you'll need to add it as a reference just like you would with the Assembly_CSharp.dll or SRML.dll files. And then add a 
using TranslationAPI;
Near the top of whatever script is gonna use the API.

And you'll also need to add this to your modinfo.json

"dependencies": [
"translationapi 1.0"
],
"load_after": [
"translationapi"
],


-----------------------------------------------------------------------------------------------------------------------------
There are 2 commands in this API to help you copy translations.

copytranslation: allows you to copy in game translation to your clipboard.
dumpbundle: dumps a bundle (group of translations) to your SlimeRancher_Data folder.

-----------------------------------------------------------------------------------------------------------------------------


There are 3 ways to register translations.

The first way:
This is similar to how SRML would do it. Except, that you'd need to figure out the bundle and key to each translation yourself.

TranslationUtil.RegisterTranslation(MessageDirector.Lang.EN, "actor", "l.random_slime", "Random Slime");
Below is the same as above
TranslationUtil.RegisterActorTranslation(MessageDirector.Lang.EN, "l.random_slime", "Random Slime");

-----------------------------------------------------------------------------------------------------------------------------

The second way:

For this way, you need to create files that have the translations in them.
You'll need to create a folder in your mod and name it "Translations". Then you'll need to create files with the names of the languages you want to add and put them in that folder.

File Names For Each Language:
German => de.yaml
English => en.yaml
Spanish => es.yaml
French => fr.yaml
Japanese => ja.yaml
Korean => ko.yaml
Portuguese => pt.yaml
Russian => ru.yaml
Swedish => sv.yaml
Chinese => zh.yaml


The files should have the .yaml extension, and their 
Build Action property should be set to Embedded Resource. 


The insides of these files contains the translations the format for each translation should be
bundle:key: value
Here are some examples

#Comment
actor:l.random_plort: Random Plort
actor:l.random_slime: Random Slime
pedia:t.random_slime_entry: Random Slime
pedia:m.intro.random_slime_entry: "Very Random\nStuff"


The files should look like this if you are in visual studio


Now that we have all that done you can register your assembly in load.
TranslationUtil.RegisterAssembly(Assembly.GetExecutingAssembly());

-----------------------------------------------------------------------------------------------------------------------------

The third way:

Not considered an actual way. But it is a useful little tool. It allows you to copy from a translation to another one.
Like this food group for example. It copies the Tarr Foodgroup Info. So the nontarrgoldslime food group will be displayed the same as the tarr foodgroup.
TranslationUtil.RegisterRedirect("ui", "m.foodgroup.tarr", "ui", "m.foodgroup.nontarrgold_slimes");