Template:Category
Jump to navigation
Jump to search
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) | link = y }}
- 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). If link parameter is set, this will be the display text (see the example below).
- lang
Target language, defaults to {{lang|}}.
- link
If set, will output category link instead.
Example
| code | output |
|---|---|
{{ category | data templates | templates }} |
wikitext: [[Category:Data templates|templates ]] (add the page to Category:Data templates, with "Templates" as the sort key) |
{{ category | data templates | link=y}} |
Category:Data templates |
{{ category | data templates | templates | link=y}} |
templates |
Notes
This template will try to localize $1 (the category name) and $2 (the sort key) in the following way:
- If
$langis a language within the main wiki[a], then the language code will simply be appended to$1(including a slash character), and$2will not be localized. - If
$langis a language with its own wiki[b]:$1and$2will 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,
$1and$2will be translated via{{tr}}.
- Note that a language's glossary is loaded once per page. Subsequent template calls will reuse it, even if their
$langparameter is different.
- Note that a language's glossary is loaded once per page. Subsequent template calls will reuse it, even if their
Data storage
- Template:Category/db-de
- Template:Category/db-fr
- Template:Category/db-pl
- Template:Category/db-pt
- Template:Category/db-ru
- Template:Category/db-zh
Examples
| Code | Result |
|---|---|
{{category|Navigational templates}} |
[[Category:Navigational templates ]]
|
{{category|Navigational templates|Wood}} |
[[Category:Navigational templates|Wood ]]
|
{{category|Navigational templates|}} |
[[Category:Navigational templates| ]]
|
{{category|Navigational templates|Wood|lang=it}} |
[[Category:Navigational templates/it|Wood ]]
|
{{category|Navigational templates|Wood|lang=de}} |
[[Category:Navigationsvorlagen|Holz ]]
|
Footnotes
- ↑ Chinese (
zh), French (fr), German (de), Hungarian (hu), Korean (ko), Polish (pl), Portuguese (pt), Russian (ru), Spanish (es), Ukrainian (uk) - ↑ Arabic (
ar), Belarusian (be), 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), Swedish (sv), Thai (th), Turkish (tr), Vietnamese (vi)