틀:LC zh
| 이 틀은 루아를 사용합니다: |
설명
이 틀은 중국어("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 = <en의 이름공간 이름>}}
유사 이름공간 이름을 포함합니다:
{{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = N|ns = <en의 이름공간 이름>|ns_2 = <en의 유사 이름공간 이름>}}
예시:
{{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 - 문서 제목
기본 이름공간에서 문서 제목의 경우:
{{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 = <en의 이름공간 이름>|zh-hans = <zh-Hans 문서 이름>|zh-hant = <zh-Hant 문서 이름>}}{{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = T|ns = <en의 이름공간 이름>|zh-hans = <zh-Hans 문서 이름>|zh-hant = <zh-Hant (zh-Hant-TW) 문서 이름>|zh-hk = <zh-Hant-HK 문서 이름>}}
유사 이름공간 이름을 포함하는 페이지 제목의 경우:
{{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = T|ns = <en의 이름공간 이름>|ns_2 = <en의 유사 이름공간 이름>|zh-hans = <zh-Hans 문서 이름>|zh-hant = <zh-Hant 문서 이름>}}{{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = T|ns = <en의 이름공간 이름>|ns_2 = <en의 유사 이름공간 이름>|zh-hans = <zh-Hans 문서 이름>|zh-hant = <zh-Hant (zh-Hant-TW) 문서 이름>|zh-hk = <zh-Hant-HK 문서 이름>}}
예시:
{{LC zh|lang = {{{lang|}}}|hide_ns = {{{nsp|}}}|type = T|ns = Project|zh-hans = 关于|zh-hant = 關於}}→ Project:关于
H - 문단 제목
제목을 사용하면 다양한 언어 변형에 대해 여러 개의 앵커를 자동으로 생성할 수 있습니다.
== {{LC zh|lang = {{{lang|}}}|type = H|zh-hans = <zh-Hans 문단 제목>|zh-hant = <zh-Hant 문단 제목>}} ==== {{LC zh|lang = {{{lang|}}}|type = H|zh-hans = <zh-Hans 문단 제목>|zh-hant = <zh-Hant (zh-Hant-TW) 문단 제목>|zh-hk = <zh-Hant-HK 문단 제목>}} ==
예시:
== {{LC zh|lang = {{{lang|}}}|type = H|zh-hans = 关于|zh-hant = 關於}} ==→ == 关于 ==
C - 콘텐츠
<pre> and <syntaxhighlight> should use this type with {{#tag: syntax to prevent broken language conversion.{{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 = 關於}}→ 关于{{#tag:syntaxhighlight|<code>{{LC zh|lang = {{{lang|}}}|type = C|zh-hans = 关于|zh-hant = 關於}}</code>|lang=wikitext|inline=}}→<code>关于</code>
U - Unconvertible content
Do not use this type for
<pre> and <syntaxhighlight>.{{LC zh|lang = {{{lang|}}}|type = U|zh-hans = <zh-Hans content>|zh-hant = <zh-Hant content>}}{{LC zh|lang = {{{lang|}}}|U|zh-hans = <zh-Hans content>|zh-hant = <zh-Hant (zh-Hant-TW) content>|zh-hk = <zh-Hant-HK content>}}
Example:
{{LC zh|lang = {{{lang|}}}|type = U|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.
틀 데이터
This is the TemplateData documentation for this template used by VisualEditor and other tools.
LC zh
Language conversion template for Mandarin namespace names, page display titles, section headings and content. Only support zh-hans, zh-hant, zh-hk
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Output language/language variant | lang | The language/language variant to output. ("zh-hans", "zh-hans", "zh-hk")
| String | optional |
| 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".
| Boolean | optional |
| Content type | type | The content type, values: "N" - Namespace names - Do not use this type in page display title, "T" - Page display title, "H" - Section heading, "C" - Text content, "U" - Unconvertible content - Only use this type in unconvertible content, e.g., global announcements, syntax highlight blocks, system messages, user page templates. Aliases: "1".
| String | required |
| English canonical namespace name | ns | (type = N, T) The canonical name of the namespace in English. Aliases: "3", "namespace".
| String | optional |
| 2nd English canonical namespace name | ns_2 | (type = N, T) The canonical name of the secondary pseudo-namespace in English. For example, "Extension" in "Help:Extension:Example".
| String | optional |
| Mandarin - Simplified Han script | zh-hans | The text content in Mandarin - Simplified Han script.
| Content | suggested |
| Mandarin - Traditional Han script | zh-hant | The text content in Mandarin - Traditional Han script.
| Content | suggested |
| Mandarin - Traditional Han script, Hong Kong | zh-hk | The text content in Mandarin - Traditional Han script, Hong Kong.
| Content | optional |
테스트 케이스
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> |