Skip to content

Basic Explanation

queue edited this page Jun 1, 2025 · 2 revisions

In order to be able to properly contribute translations to the mod, you must first understand how to edit the files located in the Localization folder of the repo.

For the purpose of contribution, this guide is very short. If you'd like to go more in-depth, you can read the tModLoader Localization wiki page, but again, it's not necessary for this.

Note that there are two main things you can add translations for: the mod itself, and vanilla content. Whichever one you decide to contribute for, it doesn't matter, as it's always appreciated!

Explanation

The localization files are split into keys and values. We're only interested in modifying the values, as they are what's shown to the user.

Let's go over a basic example of how a localization file might be structured. This example is from the mod's localization, which is used for the custom language menu.

Cultures: {
	Common: {
		StandardSubtitle: Standard
		LocalizedFontUnavailable:
			'''
			This language cannot be used because it requires a font that is currently not in the mod.
			Please wait for the next update!
			'''
	}

	English: {
		Title: English (English)
		Subtitle: United States
	}
}

Here we can see keys and values easily, and we can also see how keys can be nested into 'categories' (for example, the Cultures category, which contains two categories in itself, Common and English.).

What's really important to us is the way that values are structured. Depending on if the text is meant to be a single line or multiple lines, it can be structured in two different ways. In the Cultures.Common category we can find an example for each of these two scenarios:

# This is an example of a single line localization value

StandardSubtitle: Standard

# This is an example of a multi line localization value. Notice the use of triple quotes.

LocalizedFontUnavailable:
	'''
	This language cannot be used because it requires a font that is currently not in the mod.
	Please wait for the next update!
	'''

Pretty simple, right? But, when you're going to actually contribute, the file won't exactly look like this, it will have a few extra fragments. It might look a little more like this:

// StandardSubtitle: Standard

/* LocalizedFontUnavailable:
	'''
	This language cannot be used because it requires a font that is currently not in the mod.
	Please wait for the next update!
	''' */

Alright, this is pretty simple to work with too. When a single line localization key has two slashes at the start (//), that means it's commented out. This essentially means that the localization value will not be loaded into the game. You want to keep these slashes if, and only if, you have not translated that key's value yet. This will allow the game to properly handle untranslated things, by falling back to a default language.

You can also see something going on with the multi line key. the /* and */ that are around it are also ways of commenting something out. In this case, it's easier to do it this way for multi line text. Again, you have to remove these once you've translated that key. Remember to remove both, otherwise the localization file will count as being malformed and will not let the mod load properly.

Conclusion

And, that's kinda it for this guide. It should be pretty simple to understand, but if you have any more questions feel free to ask in the Discord.

Clone this wiki locally