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

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.

As an example, here is a default.json (English language) 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"
		}
	},

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

Kaya's mod Craftable Curiosity Lure demonstrates multi-language compatibility for CP, JA, and Producer Framework Mod.

Useful Links

Translations on the official wiki

Content Patcher: Translations

Translation requests board on GitHub

Specific tutorials on this wiki: