Template:PLURAL

From translatewiki.net
Jump to navigation Jump to search

{{PLURAL}}

Test Template Info-Icon - Version (2).svg
The documentation of this template is included from its /doc subpage. [Edit]

This is used to format plurals using the Ruby syntax (Ruby infers which value to use by detecting parameter reference "%name%" in each listed item: the first reference found is supposed to be the numeric value to test so it should be somewhere in the listed parameters. This syntax does not work natively on this wiki.

Note that MediaWiki uses another syntax where "PLURAL:" is followed by a colon and the numeric value to test (Mediawiki does not have to parse all cases to detect which value to use), before listing other parameters as pairs keyed by a plural case, or an anonymous parameter for the default translation.

How many and which plural forms can be used?

Note also that some projects will still not allow adding zome plural forms (like |zero=) if the target language of the translation does not support such plural form. For example in Dutch, the default plural rule includes only the support for a singular form (|one=text) and plural form used by default (the last |text just before the braces }} terminating the syntax used to markup the plurals). Trying to submit a translation containing such forms for such languages may cause a "strange" validation error and the submitted translation will fail to be saved. The only way to validate the translation is to drop this extra plural form (even if it appears in the source message to be translated), and contact the project maintainer to handle this special form in a separate translation unit, used internally by the code of the source project.

This template currently supports the following plural forms (also defined in LDML/CLDR), which should be specified in the following order (all of them are optional, theyr may be used only if the language is correctly set up with a suitable plural rules to classify numbers to one of these plural classes):

{{PLURAL|one=...|two=...|few=...|other=...|zero=...|...}}

where:

  • the form |one=... is used for the singular form, in languages that distinguishes it from the default plural form);
  • the form |two=... is used for the dual form, in languages that distinguish it from the default plural form (and from the singular form);
  • the form |few=... is used for the paucal form, in languages that distinguish it from the default plural form (and from the singular and dual forms);
  • the form |other=... is used for some other form for many (used for specific classes of numbers with known values), notably in Slavic languages that distinguish it from the default plural form (and from the singular, dual and paucal forms);
  • the form |zero=... is used in some languages that want to treat zero separately (depending on languages, or context of use, it may be treated as singular or plural, or could use a negated form of the sentence; it may not be supported in all languages).
  • the last form |... is used for all other plural cases (including for cases where the numeric value is large, unknown, or fractional and does not match the other cases). It should be supported in all languages (including various Asian languages that have no grammatical number distinctions, or use reduplication of nouns or use adverbs or particles inserted elsewhere in the sentence to optionally provide some plural distinctions); its given text value may still be empty.

Examples

  • {{PLURAL|one=%{count} comment|zero=No comments|%{count} comments}}{{PLURAL|one= %{count} comment |zero= No comments |%{count} comments}}
  • {{PLURAL|one=%{count} comment|%{count} comments}}{{PLURAL|one= %{count} comment |%{count} comments}}
  • Messages using this template: