Template:Plural/doc: Difference between revisions
More actions
basic documentation |
Prefix language interwiki links with w: |
||
| (15 intermediate revisions by 9 users not shown) | |||
| Line 1: | Line 1: | ||
{{TemplateBox | {{TemplateBox | ||
|1=lang | |1=lang | ||
|1d=[[w:ISO language code|ISO language code]] | |1label=language | ||
|1d-en=[[w:ISO language code|ISO language code]] | |||
|1d-td-en=ISO language code | |||
|1type=line | |||
|1def="en" (effectively) | |1def="en" (effectively) | ||
|1stat= | |1stat=suggested | ||
|2= | |||
|2d= | |2=shownum | ||
| | |2aliases=sn | ||
|2stat= | |2label-en=show number | ||
|3=2 | |2d-en=Whether to display the number which given in parameter 2; any non-empty value (e.g. "1", "yes", etc.) will work | ||
|3d= | |2type=line | ||
|3def= | |2stat=optional | ||
|3stat= | |||
|4= | |3=space | ||
|4d= | |3label-en=space type | ||
|3d-en=Which whitespace symbol to place between the number (given in parameter 2) and the text (given in parameters 3, 4, 5). <code>none</code> for no space, <code>plain</code> for regular space, <code>nb</code> or <code>nbsp</code> for {{w|non-breaking space}}. | |||
|3d-td-en=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. | |||
|3type=line | |||
|3def=nbsp | |||
|3stat=optional | |||
|4=1 | |||
|4label-en=number | |||
|4d-en= | |||
|4type=number | |||
|4def= | |4def= | ||
|4stat=required | |4stat=required | ||
|5= | |||
|5d= | |5=2 | ||
|5label-en=singular | |||
|5d-en=Singular form | |||
|5type=content | |||
|5def= | |5def= | ||
|5stat=optional | |5stat=required | ||
|6=3 | |||
|6label-en=plural | |||
|6d=Plural form (or first plural form for languages with several) | |||
|6type=content | |||
|6def= | |||
|6stat=required | |||
|7=4 | |||
|7label-en=plural 2 | |||
|7d=Second plural form for languages with several plural forms. Required for such languages, unused otherwise. | |||
|7type=content | |||
|7def= | |||
|7stat=optional | |||
|name=Plural | |name=Plural | ||
|desc=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. | |desc-en=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 [[m:Magic words#Language-dependent word conversions|<nowiki>{{PLURAL:}}</nowiki> parser function]], except that the language code is given as a parameter. | ||
|desc-td-en=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 <nowiki>{{PLURAL:}}</nowiki> parser function, except that the language code is given as a parameter. | |||
|namespace=template | |||
|usergroup=all | |||
|placement= | |||
|usage-notes=For most languages, including English, <code><nowiki>{{Plural | lang=xx | {{{n}}} | singular | plural}}</nowiki></code> is exactly equivalent to <code><nowiki>{{#ifeq: {{{n}}} | 1 | singular | plural}}</nowiki></code>, but for some languages the rules are different and some even have more than one plural form: | |||
* {{language|am}} ('''am'''), {{language|fr}} ('''fr'''), {{language|hi}} ('''hi'''), {{language|hy}} ('''hy'''), {{language|ln}} ('''ln'''), {{language|mg}} ('''mg'''), {{language|pt-br}} ('''pt-br'''), {{language|ti}} ('''ti'''), {{language|tl}} ('''tl'''), {{language|wa}} ('''wa'''): | |||
*: Zero is considered singular, not plural. | |||
* {{language|cs}} ('''cs'''), {{language|sk}} ('''sk'''): | |||
*: Czech and Slovak have two plural forms: the first, a "{{w|paucal}}" form, is used for the numbers 2, 3 and 4, while the other is used for larger numbers. | |||
* {{language|be}} ('''be'''), {{language|be-tarask}} ('''be-tarask'''), {{language|bs}} ('''bs'''), {{language|hr}} ('''hr'''), {{language|pl}} ('''pl'''), {{language|ru}} ('''ru'''), {{language|sh}} ('''sh'''), {{language|sr}} ('''sr''', '''sr-ec''', '''sr-el'''), {{language|uk}} ('''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). | |||
* {{language|ro}} ('''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 ''{{lang|ro|de}}'' is added in most cases (see {{w|Romanian numbers}}, sections "[[:w:Romanian numbers#Preposition de|Preposition ''{{lang|ro|de}}'']]" and "[[:w:Romanian numbers#Agreement between number name and modified noun|Agreement between number name and modified noun]]"). To use this, one should explicitly enter the plural form without ''{{lang|ro|de}}'' as the first plural form, and the one with ''{{lang|ro|de}}'' as the second plural form. | |||
Currently, only the exceptions listed above are implemented, but others can and should be added as needed. | |||
* {{ | |||
'''Examples:''' | |||
* <code><nowiki>"{{{n}}} {{Plural | lang=en | {{{n}}} | apple | apples }}"</nowiki></code> | |||
** produces: "0 {{Plural | lang=en | 0 | apple | apples }}", "1 {{Plural | lang=en | 1 | apple | apples }}", "2 {{Plural | lang=en | 2 | apple | apples }}", etc. | |||
* <code><nowiki>"{{{n}}} {{Plural | lang=fr | {{{n}}} | pomme | pommes }}"</nowiki></code> | |||
| | ** produces: "0 {{Plural | lang=fr | 0 | pomme | pommes }}", "1 {{Plural | lang=fr | 1 | pomme | pommes }}", "2 {{Plural | lang=fr | 2 | pomme | pommes }}", etc. | ||
| | |||
| | * <code><nowiki>"{{{n}}} {{Plural | lang=pl | {{{n}}} | jabłko | jabłka | jabłek }}"</nowiki></code> | ||
| | ** produces: "0 {{Plural | lang=pl | 0 | jabłko | jabłka | jabłek }}", "1 {{Plural | lang=pl | 1 | jabłko | jabłka | jabłek }}", "2 {{Plural | lang=pl | 2 | jabłko | jabłka | jabłek }}", "5 {{Plural | lang=pl | 5 | jabłko | jabłka | jabłek }}", etc. | ||
(To do: add more examples) | |||
|type=conditional | |type=conditional | ||
|example= | |example= | ||
|i18n-method=- | |i18n-method=- | ||
|i18n-desc= | |i18n-desc= | ||
| Line 41: | Line 90: | ||
|shorthand= | |shorthand= | ||
|relieson= | |relieson= | ||
}} | |useTemplateData=1 | ||
}}<includeonly> | |||
[[Category:Mathematical function templates]]</includeonly> | |||
Latest revision as of 09:19, 12 August 2026
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 deis added in most cases (see Romanian numbers, sections "Prepositionde" and "Agreement between number name and modified noun"). To use this, one should explicitly enter the plural form withoutdeas the first plural form, and the one withdeas the second plural form.
- 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
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
| Parameter | Description | Default | Status | |
|---|---|---|---|---|
lang | language | ISO language code | "en" (effectively) | suggested |
shownumsn | show number | Whether to display the number which given in parameter 2; any non-empty value (e.g. "1", "yes", etc.) will work | empty | optional |
space | space type | 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. | nbsp | optional |
1 | number | empty | required | |
2 | singular | Singular form | empty | required |
3 | plural | Plural form (or first plural form for languages with several) | empty | required |
4 | plural 2 | Second plural form for languages with several plural forms. Required for such languages, unused otherwise. | empty | optional |
|
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
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 Newly created template documentation and imports Wikipedia's help about TemplateData • Commons-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.
| ||||||||||||||||||||||||||||||||||||||||
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.