Opened 14 years ago

Closed 14 years ago

#15908 closed Cleanup/optimization (fixed)

Mention proper i18n approach in documentation for "pluralize" filter

Reported by: wbolster Owned by: gandalfar
Component: Documentation Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The |pluralize template filter cannot be used to pluralize words in projects using the i18n system, but this is not mentioned in the docs for that filter, i.e. on http://docs.djangoproject.com/en/1.3/ref/templates/builtins/.

The proper way to pluralize strings is to use django.utils.translation.ungettext() and friends. The docs at http://docs.djangoproject.com/en/dev/topics/i18n/internationalization/#pluralization explain this very well already, so may I suggest to refer to this part of the documentation from the |pluralize template filter documentation?

Attachments (2)

ticket15908.diff (404 bytes ) - added by gandalfar 14 years ago.
Doc patch.
15908.link_pluralize_to_blocktrans.diff (931 bytes ) - added by Julien Phalip 14 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 by Aymeric Augustin, 14 years ago

Easy pickings: set
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

You mention the |pluralize template filter, so the solution is the {% plural %} tag documented rather than ungettext.

The link should point to http://docs.djangoproject.com/en/dev/topics/i18n/internationalization/#blocktrans-template-tag

Otherwise the suggestion looks valid.

comment:2 by anonymous, 14 years ago

Owner: changed from nobody to anonymous
Status: newassigned
UI/UX: unset

comment:3 by gandalfar, 14 years ago

Owner: changed from anonymous to gandalfar
Status: assignednew

by gandalfar, 14 years ago

Attachment: ticket15908.diff added

Doc patch.

comment:4 by gandalfar, 14 years ago

Has patch: set

Attached patch adds a note to pluralize filter.

by Julien Phalip, 14 years ago

comment:5 by Julien Phalip, 14 years ago

Triage Stage: AcceptedReady for checkin

That looks good. I've just added the anchor above the "blocktrans template tag" so that the reference link works.

comment:6 by Jannis Leidel, 14 years ago

Resolution: fixed
Status: newclosed

In [16414]:

Fixed #15908 -- Mention blocktrans in the pluralize filter documentation section. Thanks, Julien Phalip.

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