pluralize
Return a plural suffix if the value is not 1, '1', or an object of length 1. By default, use 's' as the suffix:
* If value is 0, vote\{\{ value|pluralize \}\} display "votes".
* If value is 1, vote\{\{ value|pluralize \}\} display "vote".
* If value is 2, vote\{\{ value|pluralize \}\} display "votes".
If an argument is provided, use that string instead:
* If value is 0, class\{\{ value|pluralize:"es" \}\} display "classes".
* If value is 1, class\{\{ value|pluralize:"es" \}\} display "class".
* If value is 2, class\{\{ value|pluralize:"es" \}\} display "classes".
If the provided argument contains a comma, use the text before the comma
for the singular case and the text after the comma for the plural case:
* If value is 0, cand\{\{ value|pluralize:"y,ies" \}\} display "candies".
* If value is 1, cand\{\{ value|pluralize:"y,ies" \}\} display "candy".
* If value is 2, cand\{\{ value|pluralize:"y,ies" \}\} display "candies".
def pluralize(
value: any,
arg: string = "s"
) - > string
Return a plural suffix if the value is not 1, '1', or an object of length 1. By default, use 's' as the suffix.
Parameters
| Name | Type | Description |
|---|---|---|
| value | any | The value used to determine plurality, which can be a number, a numeric string, or a collection with a length. |
| arg | string = "s" | The suffix configuration; can be a single plural suffix (e.g., 'es') or a comma-separated pair for singular and plural forms (e.g., 'y,ies'). |
Returns
| Type | Description |
|---|---|
string | The appropriate singular or plural suffix based on the input value and provided arguments; returns an empty string if the argument format is invalid or the value cannot be evaluated. |