Difference between revisions of "Template:Plural"
Jump to navigation
Jump to search
(Template for proper localisation of units) |
|||
Line 1: | Line 1: | ||
− | <includeonly>{{plural:{{#expr: {{{1|}}} }}|{{#expr: {{{1|}}} }} {{{2|}}}|{{#expr: {{{1|}}} }} {{{2|}}}s}}</includeonly><noinclude>{{Documentation}}</noinclude> | + | <includeonly>{{plural:{{#expr: {{{1|}}} }}|{{#expr: {{{1|}}} }} {{{2|}}}|{{#expr: {{{1|}}} }} {{{2|}}}s}}</includeonly>{{recode|reason=Add "s" detection for automated use - [[potatoes]] not potatoess}}<noinclude>{{Documentation}}</noinclude> |
Revision as of 23:09, 17 September 2022
This page has been suggested for recoding. Reason: Add "s" detection for automated use - potatoes not potatoess. You can help RimWorld Wiki by improving it. |
Usage
This template can be used to properly localise units.
The template has two parameters:
{{Plural|"value"|"text"|link=}}
- The first parameter can be any value, usually in form of an expression. This parameter is optional. When it i omitted the template just return the plural form of the second parameter.
- The second parameter can be any text including links and templates. It should end with the unit of the value as this template simply adds an "s" at the end of the text, if the value isn't 1.
- The
link=
parameter can be set to any value, if the second parameter should be turned into a link.
Examples
{{Plural|1|component}}
produces: 1 componentThis page has been suggested for recoding. Reason: Add "s" detection for automated use - potatoes not potatoess. You can help RimWorld Wiki by improving it. |
{{Plural|2|component}}
produces: 2 componentsThis page has been suggested for recoding. Reason: Add "s" detection for automated use - potatoes not potatoess. You can help RimWorld Wiki by improving it. |
{{Plural|1/3 round 2|component}}
produces: 0.33 componentsThis page has been suggested for recoding. Reason: Add "s" detection for automated use - potatoes not potatoess. You can help RimWorld Wiki by improving it. |
{{Plural|2|component|link=true}}
produces: 2 componentsThis page has been suggested for recoding. Reason: Add "s" detection for automated use - potatoes not potatoess. You can help RimWorld Wiki by improving it. |
{{Plural||component}}
produces: componentsThis page has been suggested for recoding. Reason: Add "s" detection for automated use - potatoes not potatoess. You can help RimWorld Wiki by improving it. |
Special cases (evaluated in this order)
Bracket names
{{Plural|2|Animalist slab (broad)}}
produces: 2 Animalist slab (broad)sThis page has been suggested for recoding. Reason: Add "s" detection for automated use - potatoes not potatoess. You can help RimWorld Wiki by improving it. |
(the plural is defined by the last word before the first "(" in the string)
Uncountable things
{{Plural|2|gold}}
produces: 2 goldsThis page has been suggested for recoding. Reason: Add "s" detection for automated use - potatoes not potatoess. You can help RimWorld Wiki by improving it. |
(there is a hardcoded list of uncountable things)
Depending on last two letters
{{Plural|2|day}}
produces: 2 daysThis page has been suggested for recoding. Reason: Add "s" detection for automated use - potatoes not potatoess. You can help RimWorld Wiki by improving it. |
(everything ending in "-ay")
{{Plural|2|sash}}
produces: 2 sashsThis page has been suggested for recoding. Reason: Add "s" detection for automated use - potatoes not potatoess. You can help RimWorld Wiki by improving it. |
(everything ending in "-ch", "-sh" or "-ss")
{{Plural|2|knife}}
produces: 2 knifesThis page has been suggested for recoding. Reason: Add "s" detection for automated use - potatoes not potatoess. You can help RimWorld Wiki by improving it. |
(everything ending in "-fe")
{{Plural|2|gladius}}
produces: 2 gladiussThis page has been suggested for recoding. Reason: Add "s" detection for automated use - potatoes not potatoess. You can help RimWorld Wiki by improving it. |
(everything ending in "-us")
Depending on last letter
{{Plural|2|shelf}}
produces: 2 shelfsThis page has been suggested for recoding. Reason: Add "s" detection for automated use - potatoes not potatoess. You can help RimWorld Wiki by improving it. |
(everything ending in "-f")
{{Plural|2|molotov cocktails}}
produces: 2 molotov cocktailssThis page has been suggested for recoding. Reason: Add "s" detection for automated use - potatoes not potatoess. You can help RimWorld Wiki by improving it. |
(everything ending in "-s")
{{Plural|2|toy box}}
produces: 2 toy boxsThis page has been suggested for recoding. Reason: Add "s" detection for automated use - potatoes not potatoess. You can help RimWorld Wiki by improving it. |
(everything ending in "-x")
{{Plural|2|battery}}
produces: 2 batterysThis page has been suggested for recoding. Reason: Add "s" detection for automated use - potatoes not potatoess. You can help RimWorld Wiki by improving it. |
(everything ending in "-y")
The above documentation is transcluded from Template:Plural/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |