Changes

Jump to navigation Jump to search
2,729 bytes added ,  05:42, 4 January 2019
initial draft
{{Modding:Modder Guide/header}}

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 <tt>i18n</tt> folder containing the translation files, which you can open in a normal text editor like Notepad. The folder always has a <tt>default.json</tt> (which has the default English text), plus any of these files:

{| class="wikitable"
|-
! Language
! File name
|-
| Chinese
| <tt>zh.json</tt>
|-
| German
| <tt>de.json</tt>
|-
| Japanese
| <tt>ja.json</tt>
|-
| Portuguese
| <tt>pt.json</tt>
|-
| Russian
| <tt>ru.json</tt>
|-
| Spanish
| <tt>es.json</tt>
|}

Each file contains text that looks like this:
<source lang="javascript">
{
"translation-key": "simple translatable text",
"translation-key-2": "translatable text with a {{token}} value"
}
</source>

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

===How to translate a mod===
# Install the mod normally.
# Open the file you want to edit in its <tt>i18n</tt> folder. (If the file doesn't exist for your language yet, just copy <tt>default.json</tt> and rename it.)
# Edit the translations as needed (see ''[[#How translations work|how translations work]]'' above).
# Launch the game and choose your language. The mod should show the translation text you entered.
# 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 <code>reload_i18n</code> 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]].

{{modding guide footer
|prev = [[Modding:Modder Guide/APIs|SMAPI reference]]
|next =
}}
translators
8,447

edits

Navigation menu