Tutorial: Making a Mail Framework Mod Compatible with Other Languages (i18n)

From The Stardew Modding Wiki
Jump to navigation Jump to search

Introduction[edit | edit source | hide | hide all]

When writing this tutorial, I'm going to assume the following:

Through this tutorial, I will be referencing the MFM portion of Lunar New Year Foods. If you like, you can download it to follow along.

i18n Folder Structure in MFM[edit | edit source | hide]

For MFM, the i18n structure is pretty normal. You're going to have an i18n folder inside your main mod folder, on the same level as manifest.json and mail.json. Inside the i18n folder, you have your default.json as usual, and any additional json files for other languages you are translating it into.

Here's roughly what it should look like:

- [MFM] Main mod folder
    - i18n folder
    - mail.json
    - manifest.json

Content of Your default.json[edit | edit source | hide]

Your default.json should have a number of translation keys in it, separated by commas, each of which has some text as the associated value. I don't think you need to use a unique ID and labels that are quite as regular as these are, but it might be helpful anyways for your organizational purposes.

	"vl.LunarFoods.GusLetter.title": "New Year's Recipe",
	"vl.LunarFoods.GusLetter.content": "Dear @,^In honor of the new year, I'm getting a new recipe in stock. Feel free to come in and check it out!^   -Gus",

Referencing the Translations in mail.json[edit | edit source | hide]

Once you have all of your text set up with translation keys in default.json, you can then reference each key in your mail.json. Here's an example of how to reference them—note that they do not use any curly braces! Here, all I have done is replace the letter title and text with translation keys containing the title and the text. You only need to translate any text that the player is seeing, so you do not need to translate the letter ID or the group ID.

		"Id": "vl.LunarFoods.GusLetter",
		"GroupId": "vl.LunarFoods.ShopLetters.Random",
		"Title": "vl.LunarFoods.GusLetter.title",
		"Text": "vl.LunarFoods.GusLetter.content", 
        "WhichBG": 0,

        "HouseUpgradeLevel": 1,
        "Date": "28 winter Y1",