Skip to content

Localization

Valentin Lamprière edited this page Feb 2, 2023 · 1 revision

Introduction

This page will guides you to translate the Sewing Machine mod.

To start translating the mod, you have to access to the mod files through this github, or just by subscribing on the Steam Workshop (here).

Because of "The Binding of Isaac" API limitation, it is not possible to edit texts outside of lua files, you'll have to edit those files. luais a programming language, so you'll have to do a little bit of code :)


Finding the text files

Open the Sewing Machine folder, and look for the sewn_scripts\localization folder.

This folder contains a few files and folders :

  • en_us
  • fr
  • spa
  • localization.lua
  • localization_core.lua
  • localization_helpers.lua

Each folders in this list correspond to a language (en_us for English, fr for French etc.). The other files contains code which allows the Sewing Machine mod to handle translations.

You'll have to edit a single file here.


Setting up the files for your language

As you might guess you'll have to create a new folder which match your language. Duplicate the en_us and rename it to match your language code. You can find available language code in the External Item Description wiki

Now you have a brand new folder, but the mod still don't recognize it. You'll have to edit a script for that.

Open the localization_core.lua file an scroll down. You'll find a variable called languageCodes as :

local languageCodes = {
    "en_us", "fr", "spa"
}

Edit this line, and add your own language code (it has to match the folder name).

⚠️ This is a programming language and you'll have to be careful with this line of code. Surround your language code with quotes (") and don't forget to add a comma (,) between each language codes.

Now you've got everything needed to translate the Sewing Machine mod 🥳


Translating the mod

Open the folder you've created, there are a few files in it. Each files correspond to a "category" of texts.

Open one of those files. You should see on the very top a description on how to use it.

Usually, you'll see this line of code ⬇️ but just leave it here. Do not move or delete it!

local Icons = require("sewn_scripts.localization.localization_helpers")

You'll also see a few comments. Comments are lines which starts with two dashes --. Do not edit, move or delete those comments either!

You will be able to edit the rest :)

Here is an example of a text file.

local cards = {
    -- Warranty Card
    {
        "Warranty Card",
        "Spawns a sewing machine#The Sewing machine change depending on the room type"
    },
    
    -- Stitching Card
    {
        "Stitching Card",
        "Rerolls familiar crowns#Gives a free upgrades if none of your familiars are upgraded"
    }
}

You will only edit the lines under local cards = { To translate this file do as :

  • Skip the comment (which starts with --). So leave -- Warranty Card
  • Do not touch the curly brackets ({ and })
  • Start to translate the texts, but keep quotes! Also, keep each line in a single line, you can't type [Enter]. If you want a break, type #.

More info about formatting in the EID wiki :)