• Home
  • Random
  • Log in
  • Settings
  • About English Wikipedia @ Freddythechick
English Wikipedia @ Freddythechick

Template:Pluralize from text/sandbox

  • Language
  • Watch
  • View source
< Template:Pluralize from text
__EXPECTUNUSEDTEMPLATE__This is the template sandbox page for Template:Pluralize from text (diff).
See also the companion subpage for test cases.
Template documentation[view] [edit] [history] [purge]
WarningThis template is used on approximately 1,540,000 pages, or roughly 9% of all pages.
To avoid major disruption and server load, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them.
This template uses Lua:
  • Module:Detect singular (sandbox)

Contents

  • 1 Usage
    • 1.1 Options
  • 2 Examples
  • 3 TemplateData

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 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

{{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

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for Template:Pluralize from text in articles based on its TemplateData.

TemplateData for Pluralize from text

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

Template parameters[Edit template data]

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 singular

Label for the parameter if the value is singular

Example
Language
Stringoptional
Plural output4 plural

Label for the parameter if the value is plural

Example
Languages
Stringoptional
Wikilink5 link

Page to link to in the label

Example
Language
Page nameoptional
Turn off comma processingno_comma

By default, commas and semicolons indicate plurals. Setting to yes turns this off.

Default
No
Stringoptional
The above documentation is transcluded from Template:Pluralize from text/doc. (edit | history)
Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://enwiki.freddythechick.net/index.php?title=Template:Pluralize_from_text/sandbox&oldid=7600466"
Last edited on 9 January 2022, at 06:35

Languages

      This page is not available in other languages.

      English Wikipedia @ Freddythechick
      • This page was last edited on 9 January 2022, at 06:35.
      • Content is available under Creative Commons Attribution-ShareAlike 4.0 unless otherwise noted.
      • About English Wikipedia @ Freddythechick
      • Desktop