更改

跳到导航 跳到搜索
添加6,232字节 、 2021年4月12日 (一) 16:59
无编辑摘要
第1行: 第1行:  +
← [[模组:目录|目录]]
    +
{{翻译}}
 +
 +
SMAPI 模组可以翻译为游戏支持的任何语言。它们将自动使用与游戏相同的语言,并且如果缺少翻译,则会退回到默认文本。本页说明了如何提供或请求翻译。
 +
 +
==对于翻译者==
 +
===翻译是如何工作的===
 +
每一个模组都有一个 <tt>i18n</tt> 文件夹包含翻译文件(如果它支持翻译),可以在普通的文本编辑器(如记事本)中打开它。该文件夹始终具有 <tt>default.json</tt> 文件(具有默认的英文文本),以及以下任何文件:
 +
 +
{| class="wikitable"
 +
|-
 +
! 语言
 +
! 文件名
 +
|-
 +
| 中文
 +
| <tt>zh.json</tt>
 +
|-
 +
| 法语
 +
| <tt>fr.json</tt>
 +
|-
 +
| 德语
 +
| <tt>de.json</tt>
 +
|-
 +
| 匈牙利语
 +
| <tt>hu.json</tt>
 +
|-
 +
| 意大利语
 +
| <tt>it.json</tt>
 +
|-
 +
| 日语
 +
| <tt>ja.json</tt>
 +
|-
 +
| 韩语
 +
| <tt>ko.json</tt>
 +
|-
 +
| 葡萄牙语
 +
| <tt>pt.json</tt>
 +
|-
 +
| 俄语
 +
| <tt>ru.json</tt>
 +
|-
 +
| 西班牙语
 +
| <tt>es.json</tt>
 +
|-
 +
| 土耳其语
 +
| <tt>tr.json</tt>
 +
|}
 +
 +
Each file contains text that looks like this:
 +
<syntaxhighlight lang="javascript">
 +
{
 +
  "translation-key": "simple translatable text",
 +
  "translation-key-2": "translatable text with a {{token}} value"
 +
}
 +
</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 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.)
 +
 +
===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==
 +
===Using translations===
 +
For help using translations, see [[Modding:Modder Guide/APIs/Translation]].
 +
 +
===Request translations===
 +
<ol>
 +
<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.''
 +
# 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 <tt>default.json</tt>.)
 +
# 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.
 +
</li>
 +
 +
<li>[https://github.com/StardewModders/mod-translations/issues Create a request ticket] with this info:
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! what to enter
 +
|-
 +
| title
 +
| The mod name and version to translate.
 +
|-
 +
| labels
 +
| Choose the 'needs:' labels for the translations you need. (Don't add 'done:' labels, that's only for completed requests.)
 +
|-
 +
| Description
 +
| Provide the following information:
 +
* A brief summary of what your mod does, including a link to the mod page.
 +
* A link to the open-source code.
 +
* A download link if you're requesting translations for an unreleased version. (You can attach it directly to the request ticket.)
 +
* If needed, an explanation of where the text appears, screenshots, etc.
 +
 +
Here's [https://github.com/StardewModders/mod-translations/issues/1 an example request] which provides that info.
 +
|}</li>
 +
<li>Watch your notifications so you know when someone contributes translations or answers a question!</li>
 +
</ol>
 +
 +
[[Category:模组]]
 +
 +
[[en:Modding:Translations]]
 +
[[es:Modding:Traducciones]]
 +
[[pt:Modificações:Traduções]]
203

个编辑

导航菜单