Nhwɛsoɔ:Pluralize from text/doc

Ɛfi Wikipedia

Usage[sesa]

{{Pluralize from text|generic parameter|plural argument|singular output|plural output|wikilink (optional)}}

For use in infoboxes. Takes a generic parameter (e.g, |nickname=) and a plural argument (e.g., |nicknames=) and returns a singular output (e.g., "Nickname") if the plural argument is not given and Template:Detect singular determines that the value of |nickname= is singular by examining the text. Otherwise produces plural output (e.g., "Nicknames")

If the wikilink is provided, the returned value will use that as a link, and the output will be the link's display text.

Options[sesa]

There are four named arguments that control the pluralization:

  • |no_comma= By default, commas (or semi-colons) will cause the text string to be considered plural. Setting |no_comma=1 turns this behavior off.
  • |any_comma= By default, commas (or semi-colons) that are adjacent to digits are singular. Setting |any_comma=1 turns this behavior off.
  • |no_and= By default, "and" causes a string to be plural. Setting |no_and=1 turns this behavior off.
  • |parse_links= By default, wikilinks are considered to be unparseable (singular) objects. Setting |parse_links=1 will allow the parser to read the contents of the wikilinks and determine whether that makes the string plural.

Examples[sesa]

{{Pluralize from text|Chicagoan||singular|plural}} → singular

{{Pluralize from text|761 and 345||singular|plural}} → plural

{{Pluralize from text||761/345|singular|plural}} → plural

{{Pluralize from text|Chicagoan||Demonym|Demonyms|Demonym}}Demonym

{{Pluralize from text|761 and 345||Area Code|Area Codes|Area code}}Area Codes

TemplateData[sesa]

Helper template to adjust infobox field labels based on whether value is plural or not

Template parameters

ParameterDescriptionTypeStatus
Generic parameter1

Value of the wikitext parameter with unknown plurality

Example
{{{language|}}}
Contentrequired
Plural argument2

value of the wikitext parameter known to be plural

Example
{{{languages|}}}
Stringoptional
Singular output3

Label for the parameter if the value is singular

Example
Language
Stringrequired
Plural output4

Label for the parameter if the value is plural

Example
Languages
Stringrequired
Wikilink5

Page to link to in the label

Example
Language
Page nameoptional