Template:Category/doc
跳到导航
跳到搜索
This template is roughly an i18n-ready version of the [[Category:]]
syntax. It is intended to be used in template documentation for easier porting to language wikis.
Usage
{{ category | <category name (English)> | <sort key> (optional) | lang = <language code> (optional) }}
- First unnamed parameter
Name of the category.
- Second unnamed parameter
Sort key for the page. The blank sort key is supported (for that, the parameter value must consist only of whitespace).
- lang
Target language, defaults to {{lang|}}
.
Notes
This template will try to localize
(the category name) and $1
(the sort key) in the following way:
$2
- If
is a language within the main wiki[a], then the language code will simply be appended to$lang
(including a slash character), and$1
will not be localized.$2
- If
is a language with its own wiki[b]:$lang
and$1
will be translated according to the glossary defined in Template:Category/db-<lang>, e.g. Template:Category/db-zh for Chinese.$2
- If there is no definition in the glossary,
and$1
will be translated via$2
{{tr}}
.
- Note that a language's glossary is loaded once per page. Subsequent template calls will reuse it, even if their
parameter is different.$lang
- Note that a language's glossary is loaded once per page. Subsequent template calls will reuse it, even if their
Data storage
Examples
Code | Result |
---|---|
{{category|Navigational templates}} |
[[Category:导航模板 ]]
|
{{category|Navigational templates|Wood}} |
[[Category:导航模板|木材 ]]
|
{{category|Navigational templates|}} |
[[Category:导航模板| ]]
|
{{category|Navigational templates|Wood|lang=it}} |
[[Category:Navigational templates/it|Wood ]]
|
{{category|Navigational templates|Wood|lang=de}} |
[[:Template:Category/db-de]][[Category:导航模板|木材 ]]
|
Footnotes
- ↑ Chinese (
zh
), French (fr
), German (de
), Hungarian (hu
), Korean (ko
), Polish (pl
), Portuguese (pt
), Russian (ru
), Spanish (formal) (es-formal
), Ukrainian (uk
) - ↑ Arabic (
ar
), Bulgarian (bg
), Cantonese (yue
), Czech (cs
), Danish (da
), Dutch (nl
), Finnish (fi
), Greek (el
), Hindi (hi
), Indonesian (id
), Italian (it
), Japanese (ja
), Latvian (lv
), Lithuanian (lt
), Norwegian (no
), Romanian (ro
), Slovak (sk
), Spanish (es
), Swedish (sv
), Thai (th
), Turkish (tr
), Vietnamese (vi
)