Template:Localized link/zh
[[Special:MyLanguage/{{{1}}}|{{{1}}}]]
| 此模板被大约35,000个页面使用。 To avoid large-scale disruption and unnecessary server load, any changes to this template should first be tested in its /sandbox or /testcases subpages or in your own user subpage. The tested changes can then be added to this page in one single edit. Please consider discussing any changes on the talk page before implementing them. |
目的
此帮助模板可用于链接到用户语言的可翻译页面。
此模板使用特殊的页面前缀Special:MyLanguage/,它检查页面是否有用户语言的翻译版本,如果有,则链接到该页面;如果没有,则链接到可用的回退语言,否则链接到默认的wiki语言版本(MediaWiki为英语)。
用法
Link to translatable page in the user’s language. It uses the special page prefix “Special:MyLanguage/”.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Page name | 1 | Linked page | Page name | required |
| Displayed text | 2 | Display text for this link | Line | suggested |
| Display the namespace | nsp | If the “nsp” parameter is not defined, as link text displays the full pagename (including namespace); otherwise — if “nsp” parameter is defined by any value — link text displays the short pagename, without namespace.
| String | optional |
如果“nsp”参数未定义,作为链接文本,它将显示完整的页面名称(包括命名空间);否则 — 如果将“nsp”参数定义为任何值,则链接文本将显示短页面名称(不带命名空间)。
当链接到页面内的某个部分时,该部分不会显示在链接文本中。
简单用法示例
| 用法 | 显示 |
|---|---|
| {{ll|Communication}} | 联系交流 |
| {{ll|Communication|コミュニケーション}} | コミュニケーション |
| {{ll|Project:About}} | Project:关于 |
| {{ll|Project:About#See_also}} | Project:关于 |
| {{ll|Project:About|nsp=0}} | 关于 |
在可翻译页面中的用法
在准备翻译的带有Translate(翻译)扩展名的页面上,此模板可以通过三种方式使用。
- 替换此模板,然后将wiki链接目标嵌入到
<tvar name=id>...</tvar>中,与链接的可翻译文本分开。- 例如:
Learn more {{<tvar name=1>ll|Communication</tvar>|about communication}}.
- 例如:
- 如果链接文本与目标页面的名称相同,则所有代码也可以嵌入到
<tvar>中。- 例如:
Learn more about <tvar name=1>{{ll|Communication}}</tvar>.
- 例如:
- 对于独立链接(例如列表或表格中的链接),如果链接文本与目标页面的名称不同,则仅翻译链接文本。 这对于链接的项目符号列表很有用,例如在“参见:”部分中。 在模板语法中添加翻译标签时,请务必包含参数名称。
- 例如:
* {{ll|Project:About}}* {{ll|Communication|2=<translate>About communication</translate>}}
Test cases
| This is the template test cases page for the sandbox of Template:Localized link. to update the examples. |
| Subpage |
|---|
{{Localized link|Extension:DiscussionTools/Comparison}}
{{Localized link}} |
| Hide namespace |
|---|
{{Localized link|Extension:DiscussionTools/Comparison|nsp=0}}
{{Localized link}} |
| Hide namespace with {{LC zh/zh}}'s namespace setting |
|---|
{{Localized link|Project:About|nsp=0}}
{{Localized link}} |
参阅
- Template:Localized link/messagedoc — 应用于使用此模板的可翻译页面中的消息文档。
- {{Translatable template}} - 別名{{TNT}}或{{Tnt}}
- {{Translatable template name}} - 別名{{TNTN}}或{{Tntn}}
- {{Page language link}} - 別名{{Pll}} - 添加从可翻译页面到同一语言的另一个可翻译页面的链接