Jump to content

Template:Pluralize from text/doc

From WoemWiki
Revision as of 13:01, 16 May 2026 by wikipedia>Andrybak (→Examples: move the section above →TemplateData)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template:Mbox__EXPECTED_UNCONNECTED_PAGE__

{{Pluralize from text}} is used to detect if a text value is a plural list or not. Its intended usage is for infobox parameters, where the label might need to change from a singular version to a plural version.

For example, if an infobox uses a <syntaxhighlight lang="wikitext" inline style="display: none;" />|nickname= parameter, the label might change from Nickname to Nicknames if the text value has more than one nickname.

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

Usage

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

Examples

Parameters

There are five named parameters that control the pluralization:

  • <syntaxhighlight lang="wikitext" inline style="display: none;" />|no_comma= – By default, commas (or semicolons) will cause the text string to be considered plural. Setting <syntaxhighlight lang="wikitext" inline style="display: none;" />|no_comma=1 turns this behavior off.
  • <syntaxhighlight lang="wikitext" inline style="display: none;" />|any_comma= – By default, commas (or semicolons) that are adjacent to digits are singular. Setting <syntaxhighlight lang="wikitext" inline style="display: none;" />|any_comma=1 turns this behavior off.
  • <syntaxhighlight lang="wikitext" inline style="display: none;" />|no_and= – By default, "and" causes a string to be plural. Setting <syntaxhighlight lang="wikitext" inline style="display: none;" />|no_and=1 turns this behavior off.
  • <syntaxhighlight lang="wikitext" inline style="display: none;" />|parse_links= – By default, Wikilinks are considered to be unparseable (singular) objects. Setting <syntaxhighlight lang="wikitext" inline style="display: none;" />|parse_links=1 will allow the parser to read the contents of the Wikilinks and determine whether that makes the string plural.
  • <syntaxhighlight lang="wikitext" inline style="display: none;" />|parse_number= – Setting <syntaxhighlight lang="wikitext" inline style="display: none;" />|parse_number=1 will cause the first integer in the string to determine plurality.

Additional parameters:

  • <syntaxhighlight lang="wikitext" inline style="display: none;" />|likely= – The template makes a decision whether a string is a "likely plural" or a full "plural". The <syntaxhighlight lang="wikitext" inline style="display: none;" />|likely= argument will be the output if the template determines that the string is only "likely plural". If <syntaxhighlight lang="wikitext" inline style="display: none;" />|likely= is not given, "likely plural" and "plural" are treated identically.
  • <syntaxhighlight lang="wikitext" inline style="display: none;" />|link= – If the Wikilink is provided, the returned value will use that as a link, and the output will be the link's display text.

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
Generic parameter1
Value of the wikitext parameter with unknown plurality
⧼templatedata-doc-param-example⧽
{{{language|}}}
Plural argument2
value of the wikitext parameter known to be plural
⧼templatedata-doc-param-example⧽
{{{languages|}}}
Singular output3
singular
Label for the parameter if the value is singular
⧼templatedata-doc-param-example⧽
Language
Plural output4
plural
Label for the parameter if the value is plural
⧼templatedata-doc-param-example⧽
Languages
Wikilink5
link
Page to link to in the label
⧼templatedata-doc-param-example⧽
Language
Turn off comma processingno_comma
By default, commas and semicolons indicate plurals. Setting to "yes" turns this off.
⧼templatedata-doc-param-default⧽
No
Any comma is pluralany_comma
By default, commas and semicolons that are adjacent to digits are singular. Setting to "yes" turns this behavior off.
⧼templatedata-doc-param-default⧽
No
"And" is not pluralno_and
By default, "and" causes a string to be plural. Setting to "yes" turns this behavior off.
⧼templatedata-doc-param-default⧽
No
Parse numbersparse_number
Setting to "yes" will cause the first integer in the string to determine plurality.
⧼templatedata-doc-param-default⧽
No
Likely outputlikely
Output when input is likely, but not certain, to be plural