Template:LC zh/zh: Difference between revisions
Created page with "== 简要 ==" |
No edit summary |
||
| (29 intermediate revisions by the same user not shown) | |||
| Line 8: | Line 8: | ||
== 简要 == |
== 简要 == |
||
此模板负责处理普通话(zh)页面标题和内容的语言转换(LC),尤其适用于带/不带命名空间名称(nsp参数)的页面标题,以及语言转换器页面与非语言转换器页面间的全部内容。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
This template handles the language conversion ("LC") for Mandarin ("zh") page titles and content, especially for page titles with/without namespace names (the "nsp" parameter), content across language converter and non-language-converter pages. |
|||
</div> |
|||
<span id="Usage"></span> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
== |
== 用法 == |
||
</div> |
|||
每种内容类型的用法各不相同。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
The usage is different in each content types. |
|||
</div> |
|||
{{Note |
{{Note |
||
| type = warn |
| type = warn |
||
| text = 除非是特定的Wikitext语法(章节标题、列表),否则'''请勿'''将内容分割成碎片。 |
|||
| text = <span lang="en" dir="ltr" class="mw-content-ltr">Do '''not''' fragmentize the content unless it's specific Wikitext syntax (section headings, lists).</span> |
|||
}} |
}} |
||
| Line 44: | Line 39: | ||
{{Cross}} <syntaxhighlight lang="wikitext" inline>* 按需求{{LC zh|lang = {{{lang|}}}|type = C|zh-hans = 配置|zh-hant = 設定組態}}。</syntaxhighlight> |
{{Cross}} <syntaxhighlight lang="wikitext" inline>* 按需求{{LC zh|lang = {{{lang|}}}|type = C|zh-hans = 配置|zh-hant = 設定組態}}。</syntaxhighlight> |
||
<span id="N_-_Namespace_names"></span> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
=== N - |
=== N - 命名空间名称 === |
||
</div> |
|||
{{Note |
{{Note |
||
| type = warn |
| type = warn |
||
| text = '''请勿'''在页面显示标题中使用此类型。 |
|||
| text = <span lang="en" dir="ltr" class="mw-content-ltr">Do '''not''' use this type in page display title.</span> |
|||
}} |
}} |
||
仅命名空间名称: |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
Namespace name-only: |
|||
</div> |
|||
* {{#tag:syntaxhighlight|{{tmpl|0={{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}hide_ns = {{(((}}nsp{{!}}{{)))}}{{!}}type = N{{!}}ns = <$1>{{))}} |
* {{#tag:syntaxhighlight|{{tmpl|0={{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}hide_ns = {{(((}}nsp{{!}}{{)))}}{{!}}type = N{{!}}ns = <$1>{{))}} |
||
|1=英文中的命名空间名称 |
|||
|1=namespace name in en |
|||
}}|lang = wikitext|inline = }} |
}}|lang = wikitext|inline = }} |
||
包含伪命名空间名称: |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
Containing pseudo namespace name: |
|||
</div> |
|||
* {{#tag:syntaxhighlight|{{tmpl|0={{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}hide_ns = {{(((}}nsp{{!}}{{)))}}{{!}}type = N{{!}}ns = <$1>{{!}}ns_2 = <$2>{{))}} |
* {{#tag:syntaxhighlight|{{tmpl|0={{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}hide_ns = {{(((}}nsp{{!}}{{)))}}{{!}}type = N{{!}}ns = <$1>{{!}}ns_2 = <$2>{{))}} |
||
|1=英文中的命名空间名称 |
|||
|1=namespace name in en |
|||
|2=英文中的伪命名空间名称 |
|||
|2=pseudo namespace name in en |
|||
}}|lang = wikitext|inline = }} |
}}|lang = wikitext|inline = }} |
||
示例: |
|||
<span lang="en" dir="ltr" class="mw-content-ltr">Example:</span> |
|||
* <syntaxhighlight lang="wikitext" inline>{{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = N|ns = Help}}</syntaxhighlight> → {{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = N|ns = Help}} |
* <syntaxhighlight lang="wikitext" inline>{{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = N|ns = Help}}</syntaxhighlight> → {{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = N|ns = Help}} |
||
* <syntaxhighlight lang="wikitext" inline>{{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = N|ns = Help|ns_2 = Extension}}</syntaxhighlight> → {{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = N|ns = Help|ns_2 = Extension}} |
* <syntaxhighlight lang="wikitext" inline>{{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = N|ns = Help|ns_2 = Extension}}</syntaxhighlight> → {{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = N|ns = Help|ns_2 = Extension}} |
||
<span id="T_-_Page_display_title"></span> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
=== T - |
=== T - 页面显示标题 === |
||
</div> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
<div lang="en" dir="ltr" class="mw-content-ltr"> |
||
| Line 82: | Line 71: | ||
* {{#tag:syntaxhighlight|{{tmpl|0={{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}hide_ns = {{(((}}nsp{{!}}{{)))}}{{!}}type = T{{!}}ns = {{!}}zh-hans = <$1>{{!}}zh-hant = <$2>{{))}} |
* {{#tag:syntaxhighlight|{{tmpl|0={{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}hide_ns = {{(((}}nsp{{!}}{{)))}}{{!}}type = T{{!}}ns = {{!}}zh-hans = <$1>{{!}}zh-hant = <$2>{{))}} |
||
|1=简体中文页面名称 |
|||
|1=zh-Hans page name |
|||
|2=繁体中文页面名称 |
|||
|2=zh-Hant page name |
|||
}}|lang = wikitext|inline = }} |
}}|lang = wikitext|inline = }} |
||
| Line 91: | Line 80: | ||
* {{#tag:syntaxhighlight|{{tmpl|0={{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}hide_ns = {{(((}}nsp{{!}}{{)))}}{{!}}type = T{{!}}ns = <$1>{{!}}zh-hans = <$2>{{!}}zh-hant = <$3>{{))}} |
* {{#tag:syntaxhighlight|{{tmpl|0={{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}hide_ns = {{(((}}nsp{{!}}{{)))}}{{!}}type = T{{!}}ns = <$1>{{!}}zh-hans = <$2>{{!}}zh-hant = <$3>{{))}} |
||
|1=英文中的命名空间名称 |
|||
|1=namespace name in en |
|||
|2=简体中文页面名称 |
|||
|2=zh-Hans page name |
|||
|3=繁体中文页面名称 |
|||
|3=zh-Hant page name |
|||
}}|lang = wikitext|inline = }} |
}}|lang = wikitext|inline = }} |
||
* {{#tag:syntaxhighlight|{{tmpl|0={{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}hide_ns = {{(((}}nsp{{!}}{{)))}}{{!}}type = T{{!}}ns = <$1>{{!}}zh-hans = <$2>{{!}}zh-hant = <$3>{{!}}zh-hk = <$4>{{))}} |
* {{#tag:syntaxhighlight|{{tmpl|0={{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}hide_ns = {{(((}}nsp{{!}}{{)))}}{{!}}type = T{{!}}ns = <$1>{{!}}zh-hans = <$2>{{!}}zh-hant = <$3>{{!}}zh-hk = <$4>{{))}} |
||
|1=英文中的命名空间名称 |
|||
|1=namespace name in en |
|||
|2=简体中文页面名称 |
|||
|2=zh-Hans page name |
|||
|3=繁体中文(台湾)页面名称 |
|||
|3=zh-Hant (zh-Hant-TW) page name |
|||
|4=繁体中文(香港)页面名称 |
|||
|4=zh-Hant-HK page name |
|||
}}|lang = wikitext|inline = }} |
}}|lang = wikitext|inline = }} |
||
| Line 107: | Line 96: | ||
* {{#tag:syntaxhighlight|{{tmpl|0={{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}hide_ns = {{(((}}nsp{{!}}{{)))}}{{!}}type = T{{!}}ns = <$1>{{!}}ns_2 = <$2>{{!}}zh-hans = <$3>{{!}}zh-hant = <$4>{{))}} |
* {{#tag:syntaxhighlight|{{tmpl|0={{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}hide_ns = {{(((}}nsp{{!}}{{)))}}{{!}}type = T{{!}}ns = <$1>{{!}}ns_2 = <$2>{{!}}zh-hans = <$3>{{!}}zh-hant = <$4>{{))}} |
||
|1=英文中的命名空间名称 |
|||
|1=namespace name in en |
|||
|2=英文中的伪命名空间名称 |
|||
|2=pseudo namespace name in en |
|||
|3=简体中文页面名称 |
|||
|3=zh-Hans page name |
|||
|4=繁体中文页面名称 |
|||
|4=zh-Hant page name |
|||
}}|lang = wikitext|inline = }} |
}}|lang = wikitext|inline = }} |
||
* {{#tag:syntaxhighlight|{{tmpl|0={{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}hide_ns = {{(((}}nsp{{!}}{{)))}}{{!}}type = T{{!}}ns = <$1>{{!}}ns_2 = <$2>{{!}}zh-hans = <$3>{{!}}zh-hant = <$4>{{!}}zh-hk = <$5>{{))}} |
* {{#tag:syntaxhighlight|{{tmpl|0={{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}hide_ns = {{(((}}nsp{{!}}{{)))}}{{!}}type = T{{!}}ns = <$1>{{!}}ns_2 = <$2>{{!}}zh-hans = <$3>{{!}}zh-hant = <$4>{{!}}zh-hk = <$5>{{))}} |
||
|1=英文中的命名空间名称 |
|||
|1=namespace name in en |
|||
|2=英文中的伪命名空间名称 |
|||
|2=pseudo namespace name in en |
|||
|3=简体中文页面名称 |
|||
|3=zh-Hans page name |
|||
|4=繁体中文(台湾)页面名称 |
|||
|4=zh-Hant (zh-Hant-TW) page name |
|||
|5=繁体中文(香港)页面名称 |
|||
|5=zh-Hant-HK page name |
|||
}}|lang = wikitext|inline = }} |
}}|lang = wikitext|inline = }} |
||
示例: |
|||
<span lang="en" dir="ltr" class="mw-content-ltr">Example:</span> |
|||
* <syntaxhighlight lang="wikitext" inline>{{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = T|ns = Project|zh-hans = 关于|zh-hant = 關於}}</syntaxhighlight> → {{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = T|ns = Project|zh-hans = 关于|zh-hant = 關於}} |
* <syntaxhighlight lang="wikitext" inline>{{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = T|ns = Project|zh-hans = 关于|zh-hant = 關於}}</syntaxhighlight> → {{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = T|ns = Project|zh-hans = 关于|zh-hant = 關於}} |
||
<span id="H_-_Section_headings"></span> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
=== H - |
=== H - 章节标题 === |
||
</div> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
<div lang="en" dir="ltr" class="mw-content-ltr"> |
||
| Line 133: | Line 121: | ||
* {{#tag:syntaxhighlight|{{tmpl|0=== {{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}type = H{{!}}zh-hans = <$1>{{!}}zh-hant = <$2>{{))}} == |
* {{#tag:syntaxhighlight|{{tmpl|0=== {{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}type = H{{!}}zh-hans = <$1>{{!}}zh-hant = <$2>{{))}} == |
||
|1=简体中文章节标题 |
|||
|1=zh-Hans section heading |
|||
|2=繁体中文章节标题 |
|||
|2=zh-Hant section heading |
|||
}}|lang = wikitext|inline = }} |
}}|lang = wikitext|inline = }} |
||
* {{#tag:syntaxhighlight|{{tmpl|0=== {{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}type = H{{!}}zh-hans = <$1>{{!}}zh-hant = <$2>{{!}}zh-hk = <$3>{{))}} == |
* {{#tag:syntaxhighlight|{{tmpl|0=== {{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}type = H{{!}}zh-hans = <$1>{{!}}zh-hant = <$2>{{!}}zh-hk = <$3>{{))}} == |
||
|1=简体中文章节标题 |
|||
|1=zh-Hans section heading |
|||
|2=繁体中文(台湾)章节标题 |
|||
|2=zh-Hant (zh-Hant-TW) section heading |
|||
|3=繁体中文(香港)章节标题 |
|||
|3=zh-Hant-HK section heading |
|||
}}|lang = wikitext|inline = }} |
}}|lang = wikitext|inline = }} |
||
示例: |
|||
<span lang="en" dir="ltr" class="mw-content-ltr">Example:</span> |
|||
* <syntaxhighlight lang="wikitext" inline>== {{LC zh|lang = {{{lang|}}}|type = H|zh-hans = 关于|zh-hant = 關於}} ==</syntaxhighlight> → == {{LC zh|lang = {{{lang|}}}|type = H|zh-hans = 关于|zh-hant = 關於}} == |
* <syntaxhighlight lang="wikitext" inline>== {{LC zh|lang = {{{lang|}}}|type = H|zh-hans = 关于|zh-hant = 關於}} ==</syntaxhighlight> → == {{LC zh|lang = {{{lang|}}}|type = H|zh-hans = 关于|zh-hant = 關於}} == |
||
<span id="C_-_Content"></span> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
=== C - |
=== C - 内容 === |
||
</div> |
|||
* {{#tag:syntaxhighlight|{{tmpl|0={{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}type = C{{!}}zh-hans = <$1>{{!}}zh-hant = <$2>{{))}} |
* {{#tag:syntaxhighlight|{{tmpl|0={{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}type = C{{!}}zh-hans = <$1>{{!}}zh-hant = <$2>{{))}} |
||
|1=简体中文内容 |
|||
|1=zh-Hans content |
|||
|2=繁体中文内容 |
|||
|2=zh-Hant content |
|||
}}|lang = wikitext|inline = }} |
}}|lang = wikitext|inline = }} |
||
* {{#tag:syntaxhighlight|{{tmpl|0={{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}C{{!}}zh-hans = <$1>{{!}}zh-hant = <$2>{{!}}zh-hk =<$3>{{))}} |
* {{#tag:syntaxhighlight|{{tmpl|0={{((}}LC zh{{!}}lang = {{((}}{lang{{!}}}{{))}}{{!}}C{{!}}zh-hans = <$1>{{!}}zh-hant = <$2>{{!}}zh-hk =<$3>{{))}} |
||
|1=简体中文内容 |
|||
|1=zh-Hans content |
|||
|2=繁体中文(台湾)内容 |
|||
|2=zh-Hant (zh-Hant-TW) content |
|||
|3=繁体中文(香港)内容 |
|||
|3=zh-Hant-HK content |
|||
}}|lang = wikitext|inline = }} |
}}|lang = wikitext|inline = }} |
||
示例: |
|||
<span lang="en" dir="ltr" class="mw-content-ltr">Example:</span> |
|||
* <syntaxhighlight lang="wikitext" inline>{{LC zh|lang = {{{lang|}}}|type = C|zh-hans = 关于|zh-hant = 關於}}</syntaxhighlight> → {{LC zh|lang = {{{lang|}}}|type = C|zh-hans = 关于|zh-hant = 關於}} |
* <syntaxhighlight lang="wikitext" inline>{{LC zh|lang = {{{lang|}}}|type = C|zh-hans = 关于|zh-hant = 關於}}</syntaxhighlight> → {{LC zh|lang = {{{lang|}}}|type = C|zh-hans = 关于|zh-hant = 關於}} |
||
| Line 170: | Line 157: | ||
* {{ll|Module:Template translation}} |
* {{ll|Module:Template translation}} |
||
<span id="Notes"></span> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
== |
== 注释 == |
||
</div> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
<div lang="en" dir="ltr" class="mw-content-ltr"> |
||
| Line 178: | Line 164: | ||
</div> |
</div> |
||
<span id="Template_data"></span> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
== |
== 模板数据 == |
||
</div> |
|||
{{LC zh/doc}} |
{{LC zh/doc}} |
||
<span id="Test_cases"></span> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
== |
==测试样例== |
||
</div> |
|||
{{#invoke:LC zh/testcases|run_tests}} |
{{#invoke:LC zh/testcases|run_tests}} |
||
Latest revision as of 05:05, 21 December 2025
简要
此模板负责处理普通话(zh)页面标题和内容的语言转换(LC),尤其适用于带/不带命名空间名称(nsp参数)的页面标题,以及语言转换器页面与非语言转换器页面间的全部内容。
用法
每种内容类型的用法各不相同。
{{LC zh|lang = {{{lang|}}}|type = C|zh-hans = 按需求配置。|zh-hant = 按需求設定組態。}}
按需求{{LC zh|lang = {{{lang|}}}|type = C|zh-hans = 配置|zh-hant = 設定組態}}。
{{LC zh|lang = {{{lang|}}}|type = C|zh-hans = '''按需求配置。'''|zh-hant = '''按需求設定組態。'''}}
'''{{LC zh|lang = {{{lang|}}}|type = C|zh-hans = 按需求配置。|zh-hant = 按需求設定組態。}}'''
== {{LC zh|lang = {{{lang|}}}|type = C|zh-hans = 按需求配置。|zh-hant = 按需求設定組態。}} ==
{{LC zh|lang = {{{lang|}}}|type = C|zh-hans = == 按需求配置。 ==|zh-hant = == 按需求設定組態。 ==}}
== 按需求{{LC zh|lang = {{{lang|}}}|type = C|zh-hans = 配置|zh-hant = 設定組態}}。 ==
* {{LC zh|lang = {{{lang|}}}|type = C|zh-hans = 按需求配置。|zh-hant = 按需求設定組態。}}
{{LC zh|lang = {{{lang|}}}|type = C|zh-hans = * 按需求配置。|zh-hant = * 按需求設定組態。}}
* 按需求{{LC zh|lang = {{{lang|}}}|type = C|zh-hans = 配置|zh-hant = 設定組態}}。
N - 命名空间名称
仅命名空间名称:
{{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = N|ns = <英文中的命名空间名称>}}
包含伪命名空间名称:
{{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = N|ns = <英文中的命名空间名称>|ns_2 = <英文中的伪命名空间名称>}}
示例:
{{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = N|ns = Help}}→ Help{{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = N|ns = Help|ns_2 = Extension}}→ Help:Extension
T - 页面显示标题
For page titles in main namespace:
{{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = T|ns = |zh-hans = <简体中文页面名称>|zh-hant = <繁体中文页面名称>}}
For page titles containing namespace name:
{{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = T|ns = <英文中的命名空间名称>|zh-hans = <简体中文页面名称>|zh-hant = <繁体中文页面名称>}}{{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = T|ns = <英文中的命名空间名称>|zh-hans = <简体中文页面名称>|zh-hant = <繁体中文(台湾)页面名称>|zh-hk = <繁体中文(香港)页面名称>}}
For page titles containing pseudo namespace name:
{{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = T|ns = <英文中的命名空间名称>|ns_2 = <英文中的伪命名空间名称>|zh-hans = <简体中文页面名称>|zh-hant = <繁体中文页面名称>}}{{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = T|ns = <英文中的命名空间名称>|ns_2 = <英文中的伪命名空间名称>|zh-hans = <简体中文页面名称>|zh-hant = <繁体中文(台湾)页面名称>|zh-hk = <繁体中文(香港)页面名称>}}
示例:
{{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = T|ns = Project|zh-hans = 关于|zh-hant = 關於}}→ Project:关于
H - 章节标题
Headings can automatically generate multiple anchors for different language variants.
== {{LC zh|lang = {{{lang|}}}|type = H|zh-hans = <简体中文章节标题>|zh-hant = <繁体中文章节标题>}} ==== {{LC zh|lang = {{{lang|}}}|type = H|zh-hans = <简体中文章节标题>|zh-hant = <繁体中文(台湾)章节标题>|zh-hk = <繁体中文(香港)章节标题>}} ==
示例:
== {{LC zh|lang = {{{lang|}}}|type = H|zh-hans = 关于|zh-hant = 關於}} ==→ == 关于 ==
C - 内容
{{LC zh|lang = {{{lang|}}}|type = C|zh-hans = <简体中文内容>|zh-hant = <繁体中文内容>}}{{LC zh|lang = {{{lang|}}}|C|zh-hans = <简体中文内容>|zh-hant = <繁体中文(台湾)内容>|zh-hk =<繁体中文(香港)内容>}}
示例:
{{LC zh|lang = {{{lang|}}}|type = C|zh-hans = 关于|zh-hant = 關於}}→ 关于
Integration with other templates and modules
注释
If the template is a user page template, global announcement, etc., which cannot be converted using Language Converter, you should consider using Template:Conversion-zh instead of this template.
模板数据
TemplateData for LC zh
<templatedata>{"paramOrder":["lang","hide_ns","type","ns","ns_2","zh-hans","zh-hant","zh-hk"],"description":"Language conversion template for Mandarin namespace names, page display titles, section headings and content. Only support zh-hans, zh-hant, zh-hk","params":{"ns_2":{"suggested":false,"type":"string","required":false,"label":"2nd English canonical namespace name","example":"Extension","description":"(type = N, T) The canonical name of the secondary pseudo-namespace in English. For example, \"Extension\" in \"Help:Extension:Example\"."},"type":{"suggested":false,"type":"string","required":true,"label":"内容类型","example":"T","description":"The content type, values: \"N\" - Namespace names, \"T\" - Page display title, \"H\" - Section heading, \"C\" - Text content. Aliases: \"1\".","autovalue":"C"},"zh-hk":{"suggested":false,"type":"content","default":"{{{zh-hant|{{{zh-hans|}}}}}}","label":"Mandarin - Traditional Han script, Hong Kong","description":"The text content in Mandarin - Traditional Han script, Hong Kong.","example":"Example_zh-Hant-HK","required":false},"hide_ns":{"suggested":false,"type":"boolean","required":false,"label":"是否隐藏命名空间前缀","example":"1","description":"(type = N, T) Whether to hide the namespace prefix (only apply to parameter \"ns\", does not affect parameter \"ns_2\"). Value is passed from the \"nsp\" parameter of Template:Localized link. Aliases: \"2\", \"nsp\".","autovalue":"{{{nsp|}}}"},"zh-hant":{"suggested":true,"type":"content","default":"{{{zh-hk|{{{zh-hans|}}}}}}","label":"Mandarin - Traditional Han script","description":"The text content in Mandarin - Traditional Han script.","example":"Example_zh-Hant","required":false},"zh-hans":{"suggested":true,"type":"content","default":"{{{zh-hant|{{{zh-hk|}}}}}}","label":"Mandarin - Simplified Han script","description":"The text content in Mandarin - Simplified Han script.","example":"Example_zh-Hans","required":false},"lang":{"suggested":false,"type":"string","required":false,"label":"输出语言/语言变体","example":"zh-hant","description":"要输出的语言/语言变体。(\"zh-hans\"、\"zh-hans\"、\"zh-hk\")","autovalue":"{{{lang|}}}"},"ns":{"suggested":false,"type":"string","required":false,"label":"English canonical namespace name","example":"Help","description":"(type = N, T) The canonical name of the namespace in English. Aliases: \"3\", \"namespace\"."}}}</templatedata>编辑参数翻译
测试样例
All tests passed.
test_main:
| Text | Expected | Actual | |
|---|---|---|---|
| {{#invoke:LC zh|main}} | An error | Caught expected error: Lua error: Unknown content type code "nil". | |
| {{#invoke:LC zh|main|lang = {{{lang|}}}}} | An error | Caught expected error: Lua error: Unknown content type code "nil". | |
| {{#invoke:LC zh|main|lang = {{{lang|}}}|type = N}} | An error | Caught expected error: Lua error: Missing parameter "ns". | |
| {{#invoke:LC zh|main|lang = {{{lang|}}}|type = N|ns = }} | |||
| {{#invoke:LC zh|main|lang = {{{lang|}}}|type = N|ns = User}} | User | User | |
| {{#invoke:LC zh|main|lang = {{{lang|}}}|type = N|ns = Help}} | Help | Help | |
| {{#invoke:LC zh|main|lang = {{{lang|}}}|type = T}} | An error | Caught expected error: Lua error: Require at least one of the parameter: "zh-hans", "zh-hant", "zh-hk". | |
| {{#invoke:LC zh|main|lang = {{{lang|}}}|type = T|ns = User}} | An error | Caught expected error: Lua error in Module:LC_zh at line 591: Require at least one of the parameter: "zh-hans", "zh-hant", "zh-hk". | |
| {{#invoke:LC zh|main|lang = {{{lang|}}}|type = T|ns = User|zh-hans = Example|zh-hant = Example}} | User:Example | User:Example | |
| {{#invoke:LC zh|main|lang = {{{lang|}}}|type = T|ns = Help|zh-hans = 示例|zh-hant = 範例}} | Help:示例 | Help:示例 | |
| {{#invoke:LC zh|main|lang = {{{lang|}}}|type = T|ns = Help|zh-hant = 範例}} | Help:範例 | Help:範例 | |
| {{#invoke:LC zh|main|lang = {{{lang|}}}|type = T|hide_ns = 1|ns = Help}} | An error | Caught expected error: Lua error: Require at least one of the parameter: "zh-hans", "zh-hant", "zh-hk". | |
| {{#invoke:LC zh|main|lang = {{{lang|}}}|type = T|hide_ns = 1|ns = Help|zh-hans = 示例|zh-hant = 範例}} | 示例 | 示例 | |
| {{#invoke:LC zh|main|lang = {{{lang|}}}|type = H}} | An error | Caught expected error: Lua error in Module:LC_zh at line 620: Require at least one of the parameter: "zh-hans", "zh-hant", "zh-hk". | |
| {{#invoke:LC zh|main|lang = {{{lang|}}}|type = H|zh-hans = 用户|zh-hant = 使用者|zh-hk = 用戶}} | 用户 | 用户 | |
| {{#invoke:LC zh|main|lang = {{{lang|}}}|type = C}} | An error | Caught expected error: Lua error: Require at least one of the parameter: "zh-hans", "zh-hant", "zh-hk". | |
| {{#invoke:LC zh|main|lang = {{{lang|}}}|type=C|zh-hans=示例|zh-hant=範例}} | 示例 | 示例 |
test_template:
| Text | Expected | Actual | |
|---|---|---|---|
| {{LC zh}} | An error | Caught expected error: Lua error: Unknown content type code "nil". | |
| {{LC zh|lang = {{{lang|}}}}} | An error | Caught expected error: Lua error: Unknown content type code "nil". | |
| {{LC zh|lang = {{{lang|}}}|type = N}} | An error | Caught expected error: Lua error: Missing parameter "ns". | |
| {{LC zh|lang = {{{lang|}}}|type = N|ns = }} | |||
| {{LC zh|lang = {{{lang|}}}|type = N|ns = User}} | User | User | |
| {{LC zh|lang = {{{lang|}}}|type = N|ns = Help}} | Help | Help | |
| {{LC zh|lang = {{{lang|}}}|type = T}} | An error | Caught expected error: Lua error: Require at least one of the parameter: "zh-hans", "zh-hant", "zh-hk". | |
| {{LC zh|lang = {{{lang|}}}|type = T|ns = User}} | An error | Caught expected error: Lua error in Module:LC_zh at line 591: Require at least one of the parameter: "zh-hans", "zh-hant", "zh-hk". | |
| {{LC zh|lang = {{{lang|}}}|type = T|ns = User|zh-hans = Example|zh-hant = Example}} | User:Example | User:Example | |
| {{LC zh|lang = {{{lang|}}}|type = T|ns = Help|zh-hans = 示例|zh-hant = 範例}} | Help:示例 | Help:示例 | |
| {{LC zh|lang = {{{lang|}}}|type = T|ns = Help|zh-hant = 範例}} | Help:範例 | Help:範例 | |
| {{LC zh|lang = {{{lang|}}}|type = T|hide_ns = 1|ns = Help}} | An error | Caught expected error: Lua error: Require at least one of the parameter: "zh-hans", "zh-hant", "zh-hk". | |
| {{LC zh|lang = {{{lang|}}}|type = T|hide_ns = 1|ns = Help|zh-hans = 示例|zh-hant = 範例}} | 示例 | 示例 | |
| {{LC zh|lang = {{{lang|}}}|type = H}} | An error | Caught expected error: Lua error in Module:LC_zh at line 620: Require at least one of the parameter: "zh-hans", "zh-hant", "zh-hk". | |
| {{LC zh|lang = {{{lang|}}}|type = H|zh-hans = 用户|zh-hant = 使用者|zh-hk = 用戶}} | 用户 | 用户 | |
| {{LC zh|lang = {{{lang|}}}|type = C}} | An error | Caught expected error: Lua error: Require at least one of the parameter: "zh-hans", "zh-hant", "zh-hk". | |
| {{LC zh|lang = {{{lang|}}}|type=C|zh-hans=示例|zh-hant=範例}} | 示例 | 示例 |
test_template_localized_link:
| Text | Expected | Actual | |
|---|---|---|---|
| {{Localized link}} | [[Special:MyLanguage/{{{1}}}|{{{1}}}]]<span style="display:none">[[:{{{1}}}| ]]</span> | [[Special:MyLanguage/{{{1}}}|{{{1}}}]]<span style="display:none">[[:{{{1}}}| ]]</span> |
test_template_localized_link_sandbox:
| Text | Expected | Actual | |
|---|---|---|---|
| {{Localized link/sandbox}} | [[Special:MyLanguage/{{{1}}}|{{{1}}}]]<span style="display:none">[[:{{{1}}}| ]]</span> | [[Special:MyLanguage/{{{1}}}|{{{1}}}]]<span style="display:none">[[:{{{1}}}| ]]</span> |