This page is protected against editing.

Template:Plural

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Template documentationview · edit · history · purge ]
This documentation is transcluded from Template:Plural/doc.

This template can be used to select the singular or plural form of a word depending on a number and the grammar rules of a language. It functions more or less like the {{PLURAL:}} parser function, except that the language code is given as a parameter.

Usage

{{Plural |lang= |shownum= |space= |1= |2= |3= |4= }}

For most languages, including English, {{Plural | lang=xx | {{{n}}} | singular | plural}} is exactly equivalent to {{#ifeq: {{{n}}} | 1 | singular | plural}}, but for some languages the rules are different and some even have more than one plural form:

  • Amharic (am), French (fr), Hindi (hi), Armenian (hy), Lingala (ln), Malagasy (mg), Brazilian Portuguese (pt-br), Tigrinya (ti), Tagalog (tl), Walloon (wa):
    Zero is considered singular, not plural.
  • Czech (cs), Slovak (sk):
    Czech and Slovak have two plural forms: the first, a "paucal" form, is used for the numbers 2, 3 and 4, while the other is used for larger numbers.
  • Belarusian (be), Belarusian (Taraškievica orthography) (be-tarask), Bosnian (bs), Croatian (hr), Polish (pl), Russian (ru), Serbo-Croatian (sh), Serbian (sr, sr-ec, sr-el), Ukrainian (uk):
    Same as above, except that only the last digit matters (but numbers ending in 11–19 are always plural; so 1, 21, 31, etc. all use the singular, 2–4, 22–24, 32–34 etc. use the paucal form and 5–19, 25–29, 35–39 etc. use the plural).
  • Romanian (ro):
    For integers between 20 to 100, and for integers whose last two digits are either 00 or make a number in the range from 20 to 99, the preposition
    de
    is added in most cases (see Romanian numbers, sections "Preposition
    de
    " and "Agreement between number name and modified noun"). To use this, one should explicitly enter the plural form without
    de
    as the first plural form, and the one with
    de
    as the second plural form.

Currently, only the exceptions listed above are implemented, but others can and should be added as needed.

Examples:

  • "{{{n}}} {{Plural | lang=en | {{{n}}} | apple | apples }}"
    • produces: "0 apples", "1 apple", "2 apples", etc.
  • "{{{n}}} {{Plural | lang=fr | {{{n}}} | pomme | pommes }}"
    • produces: "0 pomme", "1 pomme", "2 pommes", etc.
  • "{{{n}}} {{Plural | lang=pl | {{{n}}} | jabłko | jabłka | jabłek }}"
    • produces: "0 jabłek", "1 jabłko", "2 jabłka", "5 jabłek", etc.

(To do: add more examples)

Template parameters

ParameterDescriptionDefaultStatus
langlanguageISO language code"en" (effectively)suggested
shownum
sn
show numberWhether to display the number which given in parameter 2; any non-empty value (e.g. "1", "yes", etc.) will workemptyoptional
spacespace typeWhich whitespace symbol to place between the number (given in parameter 2) and the text (given in parameters 3, 4, 5). none for no space, plain for regular space, nb or nbsp for non-breaking space.nbspoptional
1numberemptyrequired
2singularSingular formemptyrequired
3pluralPlural form (or first plural form for languages with several)emptyrequired
4plural 2Second plural form for languages with several plural forms. Required for such languages, unused otherwise.emptyoptional
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.


Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. ‎<nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw ‎<templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.


Wikipedia's help about TemplateDataCommons-specific information

This template can be used to select the singular or plural form of a word depending on a number and the grammar rules of a language. It functions more or less like the {{PLURAL:}} parser function, except that the language code is given as a parameter.

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
number1

Numberrequired
singular2

Singular form

Contentrequired
plural3

Plural form (or first plural form for languages with several)

Contentrequired
plural 24

Second plural form for languages with several plural forms. Required for such languages, unused otherwise.

Contentoptional
languagelang

ISO language code

Default
"en" (effectively)
Linesuggested
show numbershownum sn

Whether to display the number which given in parameter 2; any non-empty value (e.g. "1", "yes", etc.) will work

Lineoptional
space typespace

Which whitespace symbol to place between the number (given in parameter 2) and the text (given in parameters 3, 4, 5). "none" for no space, "plain" for regular space, "nb" or "nbsp" for non-breaking space.

Default
nbsp
Lineoptional

Additional information

The template is intended to be used in the following namespaces: the Template namespace

The template is intended to be used by the following user groups: all users

Localization

This template is not intended to be localized.