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)
Change History (8)
comment:1 by , 14 years ago
Easy pickings: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Cleanup/optimization |
comment:2 by , 14 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
UI/UX: | unset |
comment:3 by , 14 years ago
Owner: | changed from | to
---|---|
Status: | assigned → new |
by , 14 years ago
Attachment: | 15908.link_pluralize_to_blocktrans.diff added |
---|
comment:5 by , 14 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
That looks good. I've just added the anchor above the "blocktrans template tag" so that the reference link works.
You mention the
|pluralize
template filter, so the solution is the{% plural %}
tag documented rather thanungettext
.The link should point to http://docs.djangoproject.com/en/dev/topics/i18n/internationalization/#blocktrans-template-tag
Otherwise the suggestion looks valid.