#2202 closed enhancement (fixed)
[patch] Added optional argument to template filter "pluralize"
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Template system | Version: | dev |
Severity: | minor | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Makes the following valid in a template: {{ tomatoes|pluralize:"es" }}
Attachments (2)
Change History (10)
by , 19 years ago
Attachment: | optional_argument_to_pluralize_template_filter.diff added |
---|
comment:1 by , 19 years ago
comment:2 by , 19 years ago
The pluralize filter is a very simple 80% solution. This patch makes it more of an 85% solution, which I'm comfortable with. It just needs docs -- then it can be committed.
comment:3 by , 19 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 19 years ago
Owner: | changed from | to
---|---|
Status: | assigned → new |
comment:5 by , 19 years ago
Status: | new → assigned |
---|
by , 18 years ago
Attachment: | optional_arguments_to_pluralize.patch added |
---|
Pluralize with optional arguments (tests and documentation included)
comment:6 by , 18 years ago
This patch allows for plural/singular alternatives too, so you can have your knife/knives.
comment:7 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:8 by , 18 years ago
Note:
See TracTickets
for help on using tickets.
I dunno. The pluralize filter is a bad hack - it can't handle cases where the plural isn't formed by tacking something onto the end of the singular, e.g. man/men or knife/knives. There's a fair few of these cases in English, and it's the default in many languages.
AFAIK you can't pass more than one extra argument to a filter, so I don't think pluralize is fixable. If you care at all about grammatical correctness, you probably shouldn't be using it.