Opened 5 years ago

Closed 5 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 5 years ago.
Doc patch.
15908.link_pluralize_to_blocktrans.diff (931 bytes) - added by Julien Phalip 5 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 5 years ago by Aymeric Augustin

Easy pickings: set
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
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 Changed 5 years ago by anonymous

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

comment:3 Changed 5 years ago by gandalfar

Owner: changed from anonymous to gandalfar
Status: assignednew

Changed 5 years ago by gandalfar

Attachment: ticket15908.diff added

Doc patch.

comment:4 Changed 5 years ago by gandalfar

Has patch: set

Attached patch adds a note to pluralize filter.

Changed 5 years ago by Julien Phalip

comment:5 Changed 5 years ago by Julien Phalip

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 Changed 5 years ago by Jannis Leidel

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