Template:Plural/doc
Jump to navigation
Jump to search
This template is an alternative to {{plural:}}
that supports internalization.
Usage
{{ plural | <integer> | <singular form> | <plural form> | <second plural form> (optional) | lang = <language code> (optional) }}
- First unnamed parameter
An integer. The template outputs one of the words based on this parameter and the ruleset of the current language.
- Second unnamed parameter
Singular form of the word.
- Third unnamed parameter
Plural form of the word.
- Fourth unnamed parameter
Second plural form of the word. This parameter is needed only in the case your language has complex ruleset. If the value is not set, it will be replaced with the second unnamed parameter.
- lang
Language for the ruleset. By default it equals {{lang}}.
Examples
Code | Result | Note |
---|---|---|
{{plural|one|house|houses}}
|
{{plural}}: the first parameter must be an integer!
|
First parameter must be an integer |
{{plural|1|house}}
|
{{plural}}: at least 3 unnamed parameters must be used in this template: number, singular form, and plural form!
|
3 unnamed parameters are necessary for the correct work of the template. |
{{plural|0|house|houses}}
|
houses | English and most of the languages have simple ruleset: if the amount is not 1 then use the plural form. Otherwise, use the singular form. |
{{plural|1|house|houses}}
|
house | |
{{plural|3.14|house|houses}}
|
houses | Works with float numbers as well. |
{{plural|2|maison|maisons|lang=fr}}
|
maisons | French has a bit different ruleset: if the amount is more than 1 then use the plural form. Otherwise, use the singular form. |
{{plural|1|maison|maisons|lang=fr}}
|
maison | |
{{plural|0|maison|maisons|lang=fr}}
|
maison | |
{{plural|-1|maison|maisons|lang=fr}}
|
maison | The template can work with negative numbers as well. |
{{plural|-2|maison|maisons|lang=fr}}
|
maisons | |
{{lang/set|ru}} {{#loop:amount_of_houses|0|25|<nowiki/> * {{#var:amount_of_houses}} {{plural|{{#var:amount_of_houses}}|дом|дома|домов}} }} {{lang/set|}} |
|
Some languages (Russian as an example) have complex rulesets for plural forms. This localization guide has rulesets for many languages. |