Opened 4 years ago

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

Download all attachments as: .zip

Change History (8)

comment:1 Changed 4 years ago by aaugustin

  • Easy pickings set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to Cleanup/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 4 years ago by anonymous

  • Owner changed from nobody to anonymous
  • Status changed from new to assigned
  • UI/UX unset

comment:3 Changed 4 years ago by gandalfar

  • Owner changed from anonymous to gandalfar
  • Status changed from assigned to new

Changed 4 years ago by gandalfar

Doc patch.

comment:4 Changed 4 years ago by gandalfar

  • Has patch set

Attached patch adds a note to pluralize filter.

Changed 4 years ago by julien

comment:5 Changed 4 years ago by julien

  • Triage Stage changed from Accepted to Ready 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 4 years ago by jezdez

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

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