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

When making a navigational template, please follow the process below to get good performance and facilitate localization.

We will use {{gems}} as an example below.

Template skeleton[]

Here is a quick template for navigational templates:

{{navbox|key=<template_name>|purge=<noinclude>y</noinclude>
|$collapsed$ = {{#if:{{{collapsed|}}}|mw-collapsed|}}
|$show-potion$ = {{#if:{{{show-potion|}}}||mw-collapsed}}
}}<noinclude>{{i18n-ready}}{{doc}}<noinclude>

Some explanations:

  • The <template_name> is the index key for this navigational template, usually should be the name of this template (without "Template:"). For example, for Template:gems, it should be gems. Its value will be {{ucfirst:}}ed.
  • The |purge=<noinclude>y</noinclude> is used to purge the cache value when visit the template page directly. {{navbox}} uses LuaCache to improve performance; by doing this, we will always see the latest result.
  • Those $for$ are used to take input parameters to control whether the navbox itself or sections of navbox are collapsed.

For Template:gems, it should be:

{{navbox|key=gems|purge=<noinclude>y</noinclude>}}<noinclude>{{i18n-ready}}{{doc}}<noinclude>

The skeleton of this navigation template is complete. Now it is i18n-ready and benefits from the cache mechanism.

Next, we need to create its content.

Default (English) content[]

The default content of this navigation template should be in a /content subpage. For example, for Template:gems, it is Template:gems/content.

The default content should be in English. It will be used when the current wiki language is English, or when there is no l10n version for the current wiki language.

You can use |class = $placeholder$ in {{navbox/start}} to work with {{navbox}} to take collapsed control input.

L10n for other languages[]

Different languages will auto-use different content subpages. For English and languages with their own wiki (de, fr, hu, ko, ru, pl, pt, uk, zh

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

terraria.wiki.gg/zh/

点击下面的链接可直达本页面在新维基百科上的相应页面:
https://terraria.wiki.gg/zh/wiki/Help:制作导航模板

祝你游戏愉快。

), it will use /content; for languages within the main wiki (bg, cs, da, el, es, fi, id, it, ja, lt, lv, nl, no, ro, sk, sv, th, tr, vi, yue

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

terraria.wiki.gg/zh/

点击下面的链接可直达本页面在新维基百科上的相应页面:
https://terraria.wiki.gg/zh/wiki/Help:制作导航模板

祝你游戏愉快。

), it will use /content/<langcode>. This facilitates easy localization of the content without modifying the transclusion code, and the content of different languages will not conflict with each other, and the English version is automatically used as a fallback for languages without an l10n version.

You can follow this process for l10n:

  1. Transclude the navigation template on any page of your language. For example, use {{gems}} on Amber/it, and submit.
  2. Click the "e" link at the top left corner of the navbox; it will take you to the right content subpage for your language. If it does not exist yet, it will be pre-filled with the English version as the basis for translation.
Advertisement