Перейти к основному содержимому

How to create a language mod

Specifically for Addon Developers

This section is intended for those developing or planning to develop addons. If you're not involved in addon creation, this content may not be relevant to you.

Make sure your language would work!

Scrap Mechanic does NOT support every character of all of its fonts. To have a low chance of missing characters showing in the graphical user interfaces, make sure your font is ether supported by the game or is based around latin!

Information

ScrapComputers has a LanguageManager that allows you to translate the Graphical User Interfaces. We implemented it differently from how the game handles translations, so you can add as many languages as you want, either those supported by the game or any Latin-based language.

In the configurator, there's an option to select languages. By default, it's set to Automatic, meaning any language supported by the game and currently used by the player will automatically switch to that language. The following languages will automatically be used if the player has set their game to one of these:

(This is all languages supported by the game)

  • Brazilian Portuguese
  • Chinese
  • English
  • French
  • German
  • Italian
  • Japanese
  • Korean
  • Polish
  • Russian
  • Spanish

If the language you plan to add is NOT in the list above, the player will need to manually change their language setting for each world. Currently, there's no cross-world language syncing due to limitations in our configuration system.


Tutorial

We have NOT yet created a template for this

Normally we would have a template for this, but at the time of writing, the next update we are going to release is going to be majour and we just released a minor one.

Now that you know some knowledge about the language manager, here's how you create a language in ScrapComputers


Step 1: Install the mod tool

Skip if already done

This step is only for people who never modded before!

First step is to create mod, Open steam and go into your library. Then click the Games dropdown menu. Then enable the Tools checkbox. Now search for Scrap Mechanic Mod Tool and install it! (You will need this to publish it)


Step 2: Copy the addon template

Now go into this directory: %appdata%\Axolot Games\Scrap Mechanic\User\User_[STEAMID]\Mods. Create a new folder and this can be called anything.

Go to our GitHub and download our mod from there, Now open it with 7zip or any other program to open zip files. Then in the zip file, Go to Templates/AddonMod and copy all of its contents into the new folder you created that is in the Mods folder.


Step 3: Deleting the unnessorary files (And modifing)

Since this template is technicly for creating components, we will have to delete and modify some files.

Delete the following files/folders:

  • Scripts\ComponentTest.lua
  • Objects\Database\ShapeSets
  • meta (Optional to delete, keep this in to have syntax highlighting of the Addon API for something that will barrely use the addon API)

Modify the following files

Objects\Database\shapesets.shapedb
{
"shapeSetList": []
}

In Tools\Database\main.toolset, Change the uuid property (so change 269c7d0e-6bce-4a98-bd23-d97166b768ac) to a new uuid. Use this website to generate uuid's. This is so there wont be any conflicts.

In description.json, Change the localid property (so change 130f6849-466b-4507-8df9-bf98c28829ee) to a new uuid. You may also change the name & description. (The mod tool might overwrite it. so i suggest changing the description in the mod tool itself or steam when you upload it)


Step 4: Creating the actual language

Now we will actually start doing the language part.

Firstly, create the folder Gui\Language\[LANGUAGE_OF_YOUR_CHOOSING]. and now copy from the ScrapComputers mod, this file to that folder you've just created: Gui\Language\English\scrapcomputers.json.

How does this file work?

So there are only fields in 1 big massive JSON table. If your familuar with creating Minecraft Mods, this would look very simluar to Text.translatable (fabric) because it actually is!

Each field contains a name and value. the name is what the LanguageManager can read and the value would be the actual translated text. What your going to do is translate ALL of the text's in the file to the language your doing.


Step 5: Loading the language to ScrapComputers

To keep it simple, Copy & paste this code into your ToolTest.lua file.

-- Replace the first parameter to be your mod's local id.
-- Replace the seccond parameter to be the name of your language. (Must match with the folder name you've actually created!)
sm.scrapcomputers.languageManager.addLanguage("130f6849-466b-4507-8df9-bf98c28829ee", "English")

Step 6: Test the language

Now that you've done step 5. its time to test to see if everything worked! Join a world with your newly created mod and test all components that have Graphical User Interfaces or change the interface of your game in some way.


Step 7 (Optional): Translate the inventory descriptions

Note

This will not work if your language that your adding is not supported by the game

Go to our mod and copy Gui\Language\English\inventoryDescriptions.json to the same directory as where your scrapcomputers.json is. And then simply just translate all of its title's and descriptions.

(And make sure to test it aswel)


Step 8 (Optional): Creating a thumbnail

Every mod needs a thumbnail so its time to create a thumbnail. It doesn't have to be good. A literal flag of the language your adding would work fine. Make sure your thumbnail is under a megabyte, is a JPG or PNG and is 1080p

Copy that thumbnail to your language mod's directory where preview.jpg is. Delete that file and put your new thumbnail into that directory.


Step 9: Profit! (Uploading the mod)

Now that your mod is fully finished. Open your mod tool and open the mod. Click on the Share button thats on top-left and press Upload To Steam. ingore any popup's youl get from it (unless its a error) and then, your mod is online and you've just made a language mod for scrapcomputers!