Template:Category
跳到导航
跳到搜索
This template is i18n-ready, which means it is easy to localize for different languages. Please see I18n & l10n for Templates to learn more. |
Documentation The documentation below is transcluded from Template:Category/doc. (edit | history)
[purge]
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 $1
(the category name) and $2
(the sort key) in the following way:
- If
$lang
is a language within the main wiki[lower-alpha 1], then the language code will simply be appended to$1
(including a slash character), and$2
will not be localized. - If
$lang
is a language with its own wiki[lower-alpha 2]:$1
and$2
will be translated according to the glossary defined in Template:Category/db-<lang>, e.g. Template:Category/db-zh for Chinese.- If there is no definition in the glossary,
$1
and$2
will be translated via{{tr}}
.
- Note that a language's glossary is loaded once per page. Subsequent template calls will reuse it, even if their
$lang
parameter is different.
- 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:Navigational templates/zh ]]
|
{{category|Navigational templates|Wood}} |
[[Category:Navigational templates/zh|Wood ]]
|
{{category|Navigational templates|}} |
[[Category:Navigational templates/zh| ]]
|
{{category|Navigational templates|Wood|lang=it}} |
[[Category:Navigational templates/it|Wood ]]
|
{{category|Navigational templates|Wood|lang=de}} |
[[Category:Navigational templates/de|Wood ]]
|
Footnotes
Template:Reflist
引用错误:组名为“lower-alpha”的<ref>
标签存在,但没有找到相应的<references group="lower-alpha"/>
标签
分类:
- 使用DynamicPageList3的dplvar解析器函数的页面
- 使用DynamicPageList3解析器函数的页面
- I18n-ready templates
- Templates/zh
- 有参考文献错误的页面