Opened 10 years ago

Closed 10 years ago

#1597 closed defect (worksforme)

Pluralize filter should add the "s" on zero matches.

Reported by: pete@… Owned by: Adrian Holovaty
Component: Template system Version:
Severity: minor Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The pluralize filter in 0.91 does not add the "s" character when the given object is a sequence with zero items. It should because otherwise the text looks awkward.

Compare the current:

Search found 0 member.

With the expected:

Search found 0 members.

Change History (3)

comment:1 Changed 10 years ago by Adrian Holovaty

Resolution: invalid
Status: newclosed

You pass pluralize a number, not a sequence. In your case, do this: some_sequence|length|pluralize

comment:2 Changed 10 years ago by Chris Beaven

Resolution: invalid
Status: closedreopened

Actually Adrian, the pluralize filter does also handle sequences. I'll reopen because it's resolution shouldn't be 'invalid'.

But the code works for me (in Python at least):

>>> pluralize(['a', 'b'])
's'
>>> pluralize([])
's'
>>> pluralize(['a'])
''
>>>

comment:3 Changed 10 years ago by Adrian Holovaty

Resolution: worksforme
Status: reopenedclosed

OK, I'll change the resolution to a worksforme, then.

Note: See TracTickets for help on using tickets.
Back to Top