Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Pluralize from text/doc

Template page
Revision as of 16:50, 6 March 2025 by Matt (talk | contribs) (Created page with "{{wikipedia|page name}} {{Documentation subpage}} {{High use}} {{Lua|Module:Detect singular}} == Usage == <code><nowiki>{{Pluralize from text|generic parameter|singular=singular output|likely=likely plural output|plural=plural output|link=wikilink}}</nowiki></code><br/> <code><nowiki>{{Pluralize from text|generic parameter|plural argument|singular output|plural output|wikilink}}</nowiki></code> For use in infoboxes. Takes a generic parameter (e.g, {{para|nickname}}) and...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
This page uses Creative Commons Licensed content from Wikipedia (view authors).

Template:High use

Usage

{{Pluralize from text|generic parameter|singular=singular output|likely=likely plural output|plural=plural output|link=wikilink}}
{{Pluralize from text|generic parameter|plural argument|singular output|plural output|wikilink}}

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.

The template makes a decision whether a string is a "likely plural" or a full "plural". The |likely= argument will be the output if the template determines that the string is only "likely plural". If |likely= is not given, "likely plural" and "plural" are treated identically.

The output of the template can be forced by including {{force singular}} or {{force plural}} in the generic parameter.

Options

There are five 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.
  • |parse_number=. Setting |parse_number=1 will cause the first integer in the string to determine plurality.

Examples

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

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

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

{{Pluralize from text|Chicagoan|singular=Demonym|plural=Demonyms|link=Demonym}}Demonym

{{Pluralize from text|761 and 345|singular=Area Code|plural=Area Codes|link=Area code}}Area Codes

TemplateData

Template:Format TemplateData