How to make your mod compatible with other languages

From Stardew Modding Wiki
Jump to navigation Jump to search

Stardew Valley is played in many languages, and mods come in just as many. In order to make your mod available to as many players as possible, it's a good idea to allow to follow these tips and good practices to make your mod as accessible to translators as possible.

Different Framework Translation Guides

Depending on which framework you're using, it will have a different format for translations. Many of the frameworks use the i18n format for translations, which is explained in more detail below.

If you're writing a C# mod, you can use the i18n API detailed here on the Stardew Valley wiki.

How to ask for or offer a translation

TODO

Depending on the original author's preferences, they may prefer to publish the translation as part of the main mod, or may allow the i18n file to be published separately by the translator. Some mod authors who are not utilizing i18n (see below) may allow the upload of the full mod, but make sure you ask first!

What is i18n?

i18n, which is short for 'internationalization' is a generalized process for separating the coding aspect of a program from its textual one, making translations and localizations easier and quicker. In Stardew terms, i18n is a separate JSON, with one or more contained in a separate folder, which uses tokens to insert the right language's text at the proper areas. i18n is supported by frameworks that can utilize tokens, such as Content Patcher and Quest Framework.

A mod with i18n functionality might look like this:

Jortsjeani18n.png

In the i18n folder, you should have a default.json which the game will display when the game is played in any language it doesn't have a specific translation for. (This is usually the mod's native language.) Other languages (such as en.json for English, ko.json for Korean, pt.json for Portuguese, etc.) can also be placed in this folder. The i18n json will consist entirely of the keys used elsewhere in the mod and their definitions (that is, the text in the desired language). For example, here is a section which adds text to a Clint event in CP (from the mod Strange Machines):

{

//Event Text

"events-39270001.01": "Hello, @! *puff puff* It's, uh... it's a bit of a walk out this way, huh?$2",
"events-39270001.02": "I'm still working through my grandfather's notes on Blackstone. It's pretty difficult to work with, honestly...$2 you have to use a lot of it, but once you get it melted down and dense, it's very resistant to fire and pressure.",
"events-39270001.03": "Anyway, I was thinking about those blueprints I gave you all that time ago... the furnace and the charcoal kiln... What I'm trying to say is...$2 I came up with this blueprint that combines them and thought you might like to try it.$1 It's difficult, but I think you can handle it.",
"events-39270001.04": "Because of the Blackstone, this Brazier Furnace is more efficient, so it can make more bars with the same ores. Heh... Who would've thought that I would come up with something like this? I think my grandfather would be proud.$2",
"events-39270001.05": "Anyway, I guess I'll make the hike back into town and keep looking at those notes. And, uh... thanks for being a friend.$2 I'm in my shop all day and it's out of the way, so I don't get a lot of chances to talk to people, so thanks for always coming by.$2 Take it easy, @.",
}

And here's what the event looks like in Content Patcher with the i18n tokens:

      {
	"LogName": "Clint Event",
	"Action": "EditData",
	"Target": "Data/Events/Farm",
	"Entries": {
	"39270001/n Brazier.Furnace":"continue/64 15/farmer 64 16 2 Clint 64 18 0/pause 1500/speak Clint \"{{i18n:events-39270001.01}}\"/pause 500/speak Clint \"{{i18n:events-39270001.02}}\"/pause 500/speak Clint \"{{i18n:events-39270001.03}}\"/pause 800/itemAboveHead/playSound getNewSpecialItem/addCraftingRecipe Brazier Furnace/pause 1000/speak Clint \"{{i18n:events-39270001.04}}\"/pause 500/faceDirection Clint 1/pause 500/faceDirection Clint 0/speak Clint \"{{i18n:events-39270001.05}}\"/pause 200/end"
		}
	},

Basically, the idea is that you're setting up shortcuts or pointers for every bit of text in your mod to point at one centralized file, telling the rest of your mod "look here for text!" This makes it easy for a translator to do it all at once and not have to go poking through a bunch of separate files and parse the code.

Nomori has made an online converter which handles, dialogue, events, movie tastes, quests, and more. It is a great tool and comes highly recommended! Pathoschild also made a script for i18n'ing events. It is powerful! No longer will you have to deal with cutting and pasting dialog back and forth. Note that you need the latest version of LINQPad to run it successfully.

Example

Useful Links

Translations on the official wiki

Content Patcher: Translations

Translation requests board on GitHub

Specific tutorials on this wiki: