Template:LC zh

This page is a translated version of the page Template:LC zh and the translation is 43% complete.
Outdated translations are marked like this.
テンプレートの解説

説明

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.

使用法

The usage is different in each content types.

N - Namespace names

Namespace name-only:

  • {{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = N|ns = <namespace name in en>}}

Containing pseudo namespace name:

  • {{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = N|ns = <namespace name in en>|ns_2 = <pseudo namespace name in en>}}

Example:

  • {{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-Hans のページ名>|zh-hant = <zh-Hant のページ名>}}

For page titles containing namespace name:

  • {{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = T|ns = <英語の名前空間名>|zh-hans=<zh-Hans のページ名>|zh-hant=<zh-Hant のページ名>}}
  • {{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = T|ns = <英語の名前空間名>|zh-hans=<zh-Hans のページ名>|zh-hant=<zh-Hant (zh-Hant-TW) のページ名>|zh-hk=<zh-Hant-HK のページ名>}}

For page titles containing pseudo namespace name:

  • {{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = T|ns = <namespace name in en>|ns_2 = <pseudo namespace name in en>|zh-hans=<zh-Hans page name>|zh-hant=<zh-Hant page name>}}
  • {{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = T|ns = <namespace name in en>|ns_2 = <pseudo namespace name in en>|zh-hans=<zh-Hans page name>|zh-hant=<zh-Hant (zh-Hant-TW) page name>|zh-hk=<zh-Hant-HK page name>}}

例:

  • {{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = T|ns = Project|zh-hans = 关于|zh-hant = 關於}} → Project:关于

H - Headings

Headings can automatically generate multiple anchors for different language variants.

  • == {{LC zh|lang = {{{lang|}}}|type = H|zh-hans = <zh-Hans page name>|zh-hant = <zh-Hant page name>}} ==
  • == {{LC zh|lang = {{{lang|}}}|type = H|zh-hans = <zh-Hans page name>|zh-hant = <zh-Hant page name>|zh-hk = <zh-Hant-HK page name>}} ==

Example:

  • == {{LC zh|lang = {{{lang|}}}|type = H|zh-hans = 关于|zh-hant = 關於}} == → == 关于 ==

C: 本文

  • {{LC zh|lang = {{{lang|}}}|type = C|zh-hans=<zh-Hans の本文>|zh-hant=<zh-Hant の本文>}}
  • {{LC zh|lang = {{{lang|}}}|C|zh-hans=<zh-Hans の本文>|zh-hant=<zh-Hant (zh-Hant-TW) の本文>|zh-hk=<zh-Hant-HK の本文>}}

例:

  • {{LC zh|lang = {{{lang|}}}|type = C|zh-hans = 关于|zh-hant = 關於}} → 关于

他のテンプレートやモジュールとの連携

注記

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.

テンプレートデータ

[閲覧 · トーク · 編集]

これは、ビジュアルエディターまたは他のツールで使用される、このテンプレート向けのテンプレートデータ説明文です。

LC zh

Language conversion template for Mandarin page titles, headings and content. Only support zh-hans, zh-hant, zh-hk

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
Output language/language variantlang

The language/language variant to output. ("zh-hans", "zh-hans", "zh-hk")

Example
zh-hant
Auto value
{{{lang}}}
Stringoptional
Hide namespace prefixes?hide_ns

(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".

Example
1
Auto value
{{{nsp|}}}
Booleanoptional
Content typetype

The content type, values: "N" - Namespace names, "T" - Full page title, "H" - Heading, "C" - Text content. Aliases: "1".

Example
T
Auto value
C
Stringrequired
English canonical namespace namens

(type = N, T) The canonical name of the namespace in English. Aliases: "3", "namespace".

Example
Help
Stringoptional
2nd English canonical namespace namens_2

(type = N, T) The canonical name of the secondary pseudo-namespace in English. For example, "Extension" in "Help:Extension:Example".

Example
Extension
Stringoptional
Mandarin - Simplified Han scriptzh-hans

The text content in Mandarin - Simplified Han script.

Default
{{{zh-hant|{{{zh-hk|}}}}}}
Example
Example_zh-Hans
Contentsuggested
Mandarin - Traditional Han scriptzh-hant

The text content in Mandarin - Traditional Han script.

Default
{{{zh-hk|{{{zh-hans|}}}}}}
Example
Example_zh-Hant
Contentsuggested
Mandarin - Traditional Han script, Hong Kongzh-hk

The text content in Mandarin - Traditional Han script, Hong Kong.

Default
{{{zh-hant|{{{zh-hans|}}}}}}
Example
Example_zh-Hant-HK
Contentoptional
Edit parameter translations

テストケース

All tests passed.

test_main:

Text Expected Actual
Yes {{#invoke:LC zh|main}} An error Caught expected error: Lua error: Unknown content type code "nil".
Yes {{#invoke:LC zh|main|lang = {{{lang|}}}}} An error Caught expected error: Lua error: Unknown content type code "nil".
Yes {{#invoke:LC zh|main|lang = {{{lang|}}}|type = N}} An error Caught expected error: Lua error: Missing parameter "ns".
Yes {{#invoke:LC zh|main|lang = {{{lang|}}}|type = N|ns = }}
Yes {{#invoke:LC zh|main|lang = {{{lang|}}}|type = N|ns = User}} User User
Yes {{#invoke:LC zh|main|lang = {{{lang|}}}|type = N|ns = Help}} Help Help
Yes {{#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".
Yes {{#invoke:LC zh|main|lang = {{{lang|}}}|type = T|ns = User}} An error Caught expected error: Lua error in Module:LC_zh at line 579: Require at least one of the parameter: "zh-hans", "zh-hant", "zh-hk".
Yes {{#invoke:LC zh|main|lang = {{{lang|}}}|type = T|ns = User|zh-hans = Example|zh-hant = Example}} User:Example User:Example
Yes {{#invoke:LC zh|main|lang = {{{lang|}}}|type = T|ns = Help|zh-hans = 示例|zh-hant = 範例}} Help:示例 Help:示例
Yes {{#invoke:LC zh|main|lang = {{{lang|}}}|type = T|ns = Help|zh-hant = 範例}} Help:範例 Help:範例
Yes {{#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".
Yes {{#invoke:LC zh|main|lang = {{{lang|}}}|type = T|hide_ns = 1|ns = Help|zh-hans = 示例|zh-hant = 範例}} 示例 示例
Yes {{#invoke:LC zh|main|lang = {{{lang|}}}|type = H}} An error Caught expected error: Lua error in Module:LC_zh at line 608: Require at least one of the parameter: "zh-hans", "zh-hant", "zh-hk".
Yes {{#invoke:LC zh|main|lang = {{{lang|}}}|type = H|zh-hans = 用户|zh-hant = 使用者|zh-hk = 用戶}} 用户 用户
Yes {{#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".
Yes {{#invoke:LC zh|main|lang = {{{lang|}}}|type=C|zh-hans=示例|zh-hant=範例}} 示例 示例

test_template:

Text Expected Actual
Yes {{LC zh}} An error Caught expected error: Lua error: Unknown content type code "nil".
Yes {{LC zh|lang = {{{lang|}}}}} An error Caught expected error: Lua error: Unknown content type code "nil".
Yes {{LC zh|lang = {{{lang|}}}|type = N}} An error Caught expected error: Lua error: Missing parameter "ns".
Yes {{LC zh|lang = {{{lang|}}}|type = N|ns = }}
Yes {{LC zh|lang = {{{lang|}}}|type = N|ns = User}} User User
Yes {{LC zh|lang = {{{lang|}}}|type = N|ns = Help}} Help Help
Yes {{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".
Yes {{LC zh|lang = {{{lang|}}}|type = T|ns = User}} An error Caught expected error: Lua error in Module:LC_zh at line 579: Require at least one of the parameter: "zh-hans", "zh-hant", "zh-hk".
Yes {{LC zh|lang = {{{lang|}}}|type = T|ns = User|zh-hans = Example|zh-hant = Example}} User:Example User:Example
Yes {{LC zh|lang = {{{lang|}}}|type = T|ns = Help|zh-hans = 示例|zh-hant = 範例}} Help:示例 Help:示例
Yes {{LC zh|lang = {{{lang|}}}|type = T|ns = Help|zh-hant = 範例}} Help:範例 Help:範例
Yes {{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".
Yes {{LC zh|lang = {{{lang|}}}|type = T|hide_ns = 1|ns = Help|zh-hans = 示例|zh-hant = 範例}} 示例 示例
Yes {{LC zh|lang = {{{lang|}}}|type = H}} An error Caught expected error: Lua error in Module:LC_zh at line 608: Require at least one of the parameter: "zh-hans", "zh-hant", "zh-hk".
Yes {{LC zh|lang = {{{lang|}}}|type = H|zh-hans = 用户|zh-hant = 使用者|zh-hk = 用戶}} 用户 用户
Yes {{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".
Yes {{LC zh|lang = {{{lang|}}}|type=C|zh-hans=示例|zh-hant=範例}} 示例 示例

test_template_localized_link:

Text Expected Actual
Yes {{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
Yes {{Localized link/sandbox}} [[Special:MyLanguage/{{{1}}}|{{{1}}}]]<span style="display:none">[[:{{{1}}}| ]]</span> [[Special:MyLanguage/{{{1}}}|{{{1}}}]]<span style="display:none">[[:{{{1}}}| ]]</span>