Template:Translatable template name/zh
| 此模板被大约15,000个页面使用。 为避免大规模崩溃和不必要的服务器负载,对此模板的任何更改都应先在其/sandbox或/testcases子页面或您自己的用户子页面中进行测试。 然后经过测试的更改便可以通过单笔编辑添加到此页面。 请考虑在执行任何更改之前先于讨论页进行讨论。 |
| 使用Lua |
Purpose
此模板用于以当前页面的语言返回可翻译模板的名称。 Templates, like all other MediaWiki pages, can be translated using the Translate(翻译) extension, which creates subpages with the form "pagename/language code". 模板首先检查页面名称是否包含语言代码。 If it does, it then checks if the template name given as a first parameter has a translation in that language. If the page name does not contain a language code, or if the navigation template doesn't exist in that language, it will display the English template.
如何使用
{{ {{Translatable template name|name of navigation template}}|parameters....}}{{ {{TNTN|name of navigation template}}|parameters....}}{{ {{tntn|name of navigation template}}|parameters....}}
Example (from translatable meta:Template:Meta, used in translatable page meta:Meta:About):
{{Translatable template name|Navbar}}or{{TNTN|Navbar}}
which returns the translated versions of {{Navbar}} if it exists, or the English version if translations don't exist.
参数
The current version of the template may now include any kind of named or numbered parameters, whose values will be transferred into the called template (except for parameter 1 containing the basename of the translatable template to transclude). Numbered parameters will be shifted down by one position, all named parameters will be passed unchanged.
一个命名参数被特殊处理:
{{Translatable template name|tntns=:somename:|page name}}{{TNTN|tntns=:somename:|page name}}{{tntn|tntns=:somename:|page name}}
This tntns will be used to specify another namespace from which the translatable pagename will be transcluded, instead of referencing the page name from the default :Template: namespace. Note that this parameter is also passed (without modification) within the parameters of the transclusion.
Example with one parameters (from meta:Meta:About which is translatable):
{{ {{TNTN|Navbar}} |Meta:About}}
依赖项
- Module:Template translation (standard version)
- meta:Module:Template translation/sandbox (used when this template is called with optional parameter
sandbox=/sandbox, for testing modifications only)
参见
- {{Translatable template}}, alias {{TNT}} or {{Tnt}}