Terraria Wiki
注册
Advertisement
此页面的(部分)内容需要被翻译。
你可以帮助我们来翻译此页面。

On the Terraria Wikis, a template is i18n-ready (i.e., prepared for internationalization – i18n – and localization – l10n) if its code can be shared between different languages without requiring to create a separate template for each language. This is achieved by splitting the functionality and the messages of the template – the functionality is always the same, but the messages are translated, if necessary, based on their translations stored within the code.

This system greatly simplifies the process of maintaining templates across numerous language variants' wikis. All i18n-ready templates can be found here: Category:I18n-ready templates.

Preparation

For any specific target language, some preparation is required to get it working properly with the i18n system of the Terraria Wikis.

For languages with a separate wiki

If the target language has its own wiki subdomain,[1] the following steps are to be taken:

  • Port {{lang}} to the target language's wiki. Refer to the de and zh versions for examples.
  • Port {{l10n}} and {{l10n/register}} to the target language's wiki. This is as simple as copying the code of the English version.
  • Port {{tr}} to the target language's wiki. Refer to the de and zh versions for examples. If you still don't know how to set it up, simply put {{{1|}}} as the content of the template. This makes it a dummy template, behaving similar to the English version.

For languages without a separate wiki

If the target language does not have its own wiki subdomain and instead exists within the English wiki on language subpages,[2] the following step is to be taken:

  • Initialize the translation database of the target language: Create and/or fill Template:Tr/db-[langcode], (e.g. Template:Tr/db-es for Spanish). Refer to the es, it, and cs versions for examples. If you still don't know how to set it up, simply put {{#dplvar:set|_tr-[langcode]:__OK__|ok}} (e.g. {{#dplvar:set|_tr-es:__OK__|ok}} for Spanish) as the content of the template.

Localization

Once this preparation work has been successfully completed and the foundation for internationalization and localization of the target language has been laid, any i18n-ready template can now be localized to the target language. In order to do so, the following steps are to be taken, taking Chinese localization of {{achievement}} as an example:

Locate the localization section (usually at the very top of the code). At least the English messages are always already stored there. For {{achievement}}, we can see the en and fr l10n information:

<!-- 
//register localization info:
-->{{l10n/register|achievement|en<!--
	-->|link=Achievements<!-- 
	-->|cate=Achievement-related elements<!-- 
-->}}<!-- 
//fr version
-->{{l10n/register|achievement|fr<!-- 
	-->|link=Succès<!-- 
	-->|cate=Éléments relatifs aux succès<!-- 
-->}}<!-- 

-->

Now, add the translated Chinese messages:

<!-- 
//register localization info:
-->{{l10n/register|achievement|en<!--
	-->|link=Achievements<!-- 
	-->|cate=Achievement-related elements<!-- 
-->}}<!-- 
//fr version
-->{{l10n/register|achievement|fr<!-- 
	-->|link=Succès<!-- 
	-->|cate=Éléments relatifs aux succès<!-- 
-->}}<!-- 
//zh version
-->{{l10n/register|achievement|zh<!-- 
	-->|link=成就<!-- 
	-->|cate=成就相关元素<!-- 
-->}}<!-- 

-->

Please keep to the alphabetical order of the language codes, with English always at the very beginning.

Saving the changes now finalizes the Chinese localization of {{achievement}}. While for a language like Chinese, which has a separate wiki, a copy-paste to that language wiki is still required (see the result on the zh wiki), languages without a separate wiki are already done by now.

Lua-based templates

For Lua-based templates, such as {{item}} or {{eicons}}, the l10n work might need to be done within the Lua module. However, the process is largely the same – translate the existing English messages and add them to the l10n section of the modules. In modules, the l10n section usually consists of a text table and might also contain certain l10n-related functions or settings. See Module:Item and Module:Exclusive for examples.

Footnotes

  1. (zh
    亲爱的玩家,来错地方啦!
    此处已不是泰拉瑞亚官方维基百科且早已停止内容维护。
    新的泰拉瑞亚官方维基百科是:

    terraria.wiki.gg/zh/

    点击下面的链接可直达本页面在新维基百科上的相应页面:
    https://terraria.wiki.gg/zh/wiki/Help:模板的国际化与本地化

    祝你游戏愉快。
    )
    , French (fr), German (de), Hungarian (hu), Korean (ko), Polish (pl), Portuguese (pt), Russian (ru), Ukrainian (uk)
  2. (yue
    亲爱的玩家,来错地方啦!
    此处已不是泰拉瑞亚官方维基百科且早已停止内容维护。
    新的泰拉瑞亚官方维基百科是:

    terraria.wiki.gg/zh/

    点击下面的链接可直达本页面在新维基百科上的相应页面:
    https://terraria.wiki.gg/zh/wiki/Help:模板的国际化与本地化

    祝你游戏愉快。
    )
    , Bulgarian (bg), Czech (cs), Danish (da), Dutch (nl), Finnish (fi), Greek (el), Indonesian (id), Italian (it), Japanese (ja), Latvian (lv), Lithuanian (lt), Norwegian (no), Romanian (ro), Slovak (sk), Spanish (es), Swedish (sv), Thai (th), Turkish (tr), Vietnamese (vi)
Advertisement