Modding:Translations

From Stardew Valley Wiki
Revision as of 05:42, 4 January 2019 by Pathoschild (talk | contribs) (initial draft)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Creating SMAPI mods SMAPI mascot.png


Modding:Index

SMAPI mods can be translated into any language the game supports. They'll automatically use the same language as the game, and will fallback to the default text if a translation is missing. This page explains how to find or provide translations.

For translators

How translations work

Each mod has an i18n folder containing the translation files, which you can open in a normal text editor like Notepad. The folder always has a default.json (which has the default English text), plus any of these files:

Language File name
Chinese zh.json
German de.json
Japanese ja.json
Portuguese pt.json
Russian ru.json
Spanish es.json

Each file contains text that looks like this:

{
   "translation-key": "simple translatable text",
   "translation-key-2": "translatable text with a {{token}} value"
}

The first part (before :) is the unique key for the translation. This is how the mod identifies the translation, so you shouldn't change it.

The second part (after :) is the translation text, which you can change. Sometimes this will contain a token, which looks like {{token}}; this will be replaced with different text when the mod runs, so you shouldn't change the text between {{ and }}. For example, if the text says "You have {{count}} gold", the player would actually see something like You have 500 gold in-game.

How to translate a mod

  1. Install the mod normally.
  2. Open the file you want to edit in its i18n folder. (If the file doesn't exist for your language yet, just copy default.json and rename it.)
  3. Edit the translations as needed (see how translations work above).
  4. Launch the game and choose your language. The mod should show the translation text you entered.
  5. Send the edited file to the mod author, so they can add it to the official release.

Tips:

  • If you see broken symbols in-game, try saving the translation file with UTF-8 encoding.
  • You can test translation changes in-game without restarting the game. Enter reload_i18n into the SMAPI console to reload translations. (If a mod internally cached a translation, it may not be updated.)

For modders

Using translations

For help using translations, see Modding:Modder Guide/APIs/Translation.