Editing
Template:Pluralize from text/doc
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Documentation subpage}} {{High use}} {{Lua|Module:Detect singular}} == Usage == <code><nowiki>{{Pluralize from text|generic parameter|singular=singular 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 a plural argument (e.g., {{para|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 {{para|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=== There are four named arguments that control the pluralization: * {{para|no_comma}} By default, commas (or semi-colons) will cause the text string to be considered plural. Setting {{para|no_comma|1}} turns this behavior off. * {{para|any_comma}} By default, commas (or semi-colons) that are adjacent to digits are singular. Setting {{para|any_comma|1}} turns this behavior off. * {{para|no_and}} By default, "and" causes a string to be plural. Setting {{para|no_and|1}} turns this behavior off. * {{para|parse_links}} By default, wikilinks are considered to be unparseable (singular) objects. Setting {{para|parse_links|1}} will allow the parser to read the contents of the wikilinks and determine whether that makes the string plural. ==Examples== <code><nowiki>{{Pluralize from text|Chicagoan|singular=singular|plural=plural}}</nowiki></code> β {{Pluralize from text|Chicagoan|singular=singular|plural=plural}} <code><nowiki>{{Pluralize from text|761 and 345|singular=singular|plural=plural}}</nowiki></code> β {{Pluralize from text|761 and 345|singular=singular|plural=plural}} <code><nowiki>{{Pluralize from text||761/345|singular=singular|plural=plural}}</nowiki></code> β {{Pluralize from text||761/345|singular=singular|plural=plural}} <code><nowiki>{{Pluralize from text|Chicagoan|singular=Demonym|plural=Demonyms|link=Demonym}}</nowiki></code> β {{Pluralize from text|Chicagoan|singular=Demonym|plural=Demonyms|link=Demonym}} <code><nowiki>{{Pluralize from text|761 and 345|singular=Area Code|plural=Area Codes|link=Area code}}</nowiki></code> β {{Pluralize from text|761 and 345|singular=Area Code|plural=Area Codes|link=Area code}} ==TemplateData== {{Format TemplateData|1=<templatedata> { "params": { "1": { "label": "Generic parameter", "description": "Value of the wikitext parameter with unknown plurality", "type": "content", "required": true, "example": "{{{language|}}}" }, "2": { "label": "Plural argument", "description": "value of the wikitext parameter known to be plural", "type": "string", "example": "{{{languages|}}}" }, "3": { "label": "Singular output", "description": "Label for the parameter if the value is singular", "type": "string", "required": false, "aliases": ["singular"], "example": "Language" }, "4": { "label": "Plural output", "description": "Label for the parameter if the value is plural", "type": "string", "required": false, "aliases": ["plural"], "example": "Languages" }, "5": { "label": "Wikilink", "description": "Page to link to in the label", "type": "wiki-page-name", "aliases": ["link"], "example": "Language" }, "no_comma": { "label": "Turn off comma processing", "description": "By default, commas and semicolons indicate plurals. Setting to yes turns this off.", "type": "string", "required": false, "default": "No" } }, "description": "Helper template to adjust infobox field labels based on whether value is plural or not", "paramOrder": [ "1", "2", "3", "4", "5", "no_comma" ] } </templatedata>}} <includeonly>{{sandbox other|| <!-- Categories below this line --> }}</includeonly>
Edit summary
(Briefly describe your changes)
Please note that all contributions to A2wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
A2wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Documentation subpage
(
edit
)
Template:Format TemplateData
(
edit
)
Template:High-use
(
edit
)
Template:High use
(
edit
)
Template:Lua
(
edit
)
Template:Mbox
(
edit
)
Template:Para
(
edit
)
Template:Pluralize from text
(
edit
)
Template:Pluralize from text/doc
(
edit
)
Template:Sandbox other
(
edit
)
Template:Strong
(
edit
)
Template:TemplateData header
(
edit
)
Template:Template other
(
edit
)
Template:Template parameter usage
(
edit
)
Template:Terminate sentence
(
edit
)
Template:Yesno
(
edit
)
Template:Yesno-no
(
edit
)
Template:Yesno-yes
(
edit
)
Module:Arguments
(
edit
)
Module:Check for unknown parameters
(
edit
)
Module:Detect singular
(
edit
)
Module:Format TemplateData
(
edit
)
Module:High-use
(
edit
)
Module:List
(
edit
)
Module:Lua banner
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Plain text
(
edit
)
Module:String
(
edit
)
Module:TableTools
(
edit
)
Module:Text
(
edit
)
Module:Transclusion count
(
edit
)
Module:Transclusion count/data/P
(
edit
)
Module:Yesno
(
edit
)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Template
Discussion
English
Views
Read
Edit source
View history
More
Search
Navigation
Main page
Current events
Random page
About A2wiki
interaction
Help
Community portal
Recent changes
Upload file
Tools
What links here
Related changes
Special pages
Page information