Code

Opened 8 years ago

Closed 8 years ago

#1597 closed defect (worksforme)

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

Reported by: pete@… Owned by: adrian
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.

Attachments (0)

Change History (3)

comment:1 Changed 8 years ago by adrian

  • Resolution set to invalid
  • Status changed from new to closed

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

comment:2 Changed 8 years ago by SmileyChris

  • Resolution invalid deleted
  • Status changed from closed to reopened

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 8 years ago by adrian

  • Resolution set to worksforme
  • Status changed from reopened to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.