Changes

Jump to navigation Jump to search
→‎How to translate a mod: Added info about the 'Internationalization' mod translation tool mod.
Line 1: Line 1: −
{{Modding:Modder Guide/header}}
+
← [[Modding:Index|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.
+
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 provide or request translations.
    
==For translators==
 
==For translators==
 
===How translations work===
 
===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:
+
Each mod has an <samp>i18n</samp> folder containing the translation files (if it supports translation), which you can open in a normal text editor like Notepad. The folder always has a <samp>default.json</samp> (which has the default English text), plus any of these files:
    
{| class="wikitable"
 
{| class="wikitable"
Line 13: Line 13:  
|-
 
|-
 
| Chinese
 
| Chinese
| <tt>zh.json</tt>
+
| <samp>zh.json</samp>
 +
|-
 +
| French
 +
| <samp>fr.json</samp>
 
|-
 
|-
 
| German
 
| German
| <tt>de.json</tt>
+
| <samp>de.json</samp>
 +
|-
 +
| Hungarian
 +
| <samp>hu.json</samp>
 +
|-
 +
| Italian
 +
| <samp>it.json</samp>
 
|-
 
|-
 
| Japanese
 
| Japanese
| <tt>ja.json</tt>
+
| <samp>ja.json</samp>
 +
|-
 +
| Korean
 +
| <samp>ko.json</samp>
 
|-
 
|-
 
| Portuguese
 
| Portuguese
| <tt>pt.json</tt>
+
| <samp>pt.json</samp>
 
|-
 
|-
 
| Russian
 
| Russian
| <tt>ru.json</tt>
+
| <samp>ru.json</samp>
 
|-
 
|-
 
| Spanish
 
| Spanish
| <tt>es.json</tt>
+
| <samp>es.json</samp>
 +
|-
 +
| Turkish
 +
| <samp>tr.json</samp>
 +
|-
 +
| custom languages
 +
| ''file name matches the language's <samp>LanguageCode</samp> field''
 
|}
 
|}
    
Each file contains text that looks like this:
 
Each file contains text that looks like this:
<source lang="javascript">
+
<syntaxhighlight lang="javascript">
 
{
 
{
 
   "translation-key": "simple translatable text",
 
   "translation-key": "simple translatable text",
 
   "translation-key-2": "translatable text with a {{token}} value"
 
   "translation-key-2": "translatable text with a {{token}} value"
 
}
 
}
</source>
+
</syntaxhighlight>
    
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 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.
Line 45: Line 63:  
===How to translate a mod===
 
===How to translate a mod===
 
# Install the mod normally.
 
# 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.)
+
# Open the file you want to edit in its <samp>i18n</samp> folder. (If the file doesn't exist for your language yet, just copy <samp>default.json</samp> and rename it.)
 
# Edit the translations as needed (see ''[[#How translations work|how translations work]]'' above).
 
# 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.
 
# Launch the game and choose your language. The mod should show the translation text you entered.
Line 53: Line 71:  
* If you see broken symbols in-game, try saving the translation file with UTF-8 encoding.
 
* 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.)
 
* 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.)
 +
* There's an [https://www.nexusmods.com/stardewvalley/mods/21317 Internationalization] mod in development that aims to simplify the translation process. In particular updating existing translations. It replaces steps 2-4 above. If you install that and run the game, you can open a page in your web browser to update translations of your installed mods live. It takes care of the json & utf-8 encoding so you don't have to. It's very new, so it might still have bugs.
 +
 +
===How to provide mod translations===
 +
You can provide translations anytime. There's no commitment needed — your help is appreciated whether you only help once or keep coming back!
 +
 +
Here's the standard process:
 +
 +
# [https://github.com/ Create an account on GitHub].
 +
# [https://github.com/StardewModders/mod-translations/issues View the open translation requests]. To only see requests for your language, click the 'Labels' dropdown and choose the <code>needs:</code> label for it.
 +
# Click a request to see the details (including what the mod does, where to download it, and what translations are needed).
 +
# Install the mod and edit the translations on your computer (see the previous section).
 +
# Copy your translation text, and paste it into a comment on the GitHub request. <small>(If you're comfortable with GitHub, feel free to submit a pull request to the author instead.)</small>
 +
 +
That's it! The mod author will add your translations to the mod, so it'll be available in your language in the next release.
 +
 +
'''Tips:'''
 +
* If a mod has a ''lot'' of translations, feel free to only translate some of them. Someone else can finish the translations if needed.
    
==For modders==
 
==For modders==
Line 58: Line 93:  
For help using translations, see [[Modding:Modder Guide/APIs/Translation]].
 
For help using translations, see [[Modding:Modder Guide/APIs/Translation]].
   −
===Request translations===
+
===Translation summary===
<div style="border: 1px solid gray; border-left: 1em solid gray; padding: 0.5em 1em; border-radius: 5px;">'''This is a draft. Please don't request translations this way yet.'''</div>
+
If your mod is [[Modding:Open source|open-source]], you can add a translation summary to your repository's <samp>README.md</samp> file ([https://github.com/Pathoschild/StardewMods/#translating-the-mods see an example]). This makes it much more likely that translators will contribute translations for your mod since it...
 +
* indicates that contributions are welcome;
 +
* explains how to provide translations;
 +
* and provides a summary of each mod's translation status and links.
   −
You can ask translators to provide translations for your mod. This can be a lot of work and translators often don't get much credit, so we ask for a bit of upfront work to make it easier.
+
You can [https://gist.github.com/Pathoschild/040ff6c8dc863ed2a7a828aa04447033 auto-generate the translation summary using a script].
    +
===Request translations===
 
<ol>
 
<ol>
   
<li>Before you start:
 
<li>Before you start:
# Your mod '''must''' be open-source on a public site like [https://github.com/ GitHub].<br />''This is important for the modders curating the request list, since it lets them (a) check the current status of your mod translations to keep requests up-to-date, (b) answer questions from translators if needed, and (c) submit a pull request with any translations received when the ticket is closed if you stop responding.''
+
# Your mod '''must''' be [[Modding:Open source|open-source]] on a public site like [https://github.com/ GitHub].<br />''This is important for the modders curating the request list, since it lets them (a) check the current status of your mod translations to keep requests up-to-date, (b) answer questions from translators if needed, and (c) submit a pull request with any translations received when the ticket is closed if you stop responding.''
 +
# If you have partial translations, copy any missing translations into all translation files and mark them with <code>// TODO</code>. (That way translators only need to look at their language's file, they don't need to compare it with <samp>default.json</samp>.)
 
# Make sure you watch the request and you have time to reply to questions! Your request will be closed if you don't respond to a question on the ticket within 72 hours.
 
# Make sure you watch the request and you have time to reply to questions! Your request will be closed if you don't respond to a question on the ticket within 72 hours.
# The <tt>default.json</tt> must be complete and in English. If your main language isn't English and you need help preparing it, we can help! Just create a request the same way below, but choose <code>needs: English copyediting</code> as the label instead.
+
# The <samp>default.json</samp> must be complete and in English. If your main language isn't English and you need help preparing it, we can help! Just create a request the same way below, but choose <code>needs: English copyediting</code> as the label instead.
 
</li>
 
</li>
   Line 95: Line 134:  
</ol>
 
</ol>
   −
{{modding guide footer
+
==See also==
|prev = [[Modding:Modder Guide/APIs|SMAPI reference]]
+
* [[Modding:Custom languages]]
|next =
+
 
}}
+
[[Category:Modding]]
 +
 
 +
[[es:Modding:Traducciones]]
 +
[[pt:Modificações:Traduções]]
 +
[[ru:Модификации:Руководство по переводу модификаций]]
 +
[[zh:模组:翻译模组]]
20

edits

Navigation menu