Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#15287 closed (fixed)

Error messages in generic views are partialy translated

Reported by: szczav Owned by: nobody
Component: Generic views Version: dev
Severity: Keywords: generic views http404 translation error blocker
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

Http404 error messages in class based generic views are not translated, but model names passed to them are. Example:

raise Http404("No %s available" % model._meta.verbose_name)

Messages should be translated completely or not translated at all. As I see in Django source code they are almost always not translated. I think that model._meta.verbose_name should be replaced by model._meta.object_name.

It's related with #12418.

Attachments (2)

patch.diff (4.3 KB ) - added by szczav 14 years ago.
patch2.diff (19.0 KB ) - added by szczav 14 years ago.

Download all attachments as: .zip

Change History (8)

by szczav, 14 years ago

Attachment: patch.diff added

comment:1 by szczav, 14 years ago

Has patch: set

comment:2 by Russell Keith-Magee, 14 years ago

Keywords: blocker added
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

Accepting the issue, but I lean towards the other proposed solution -- taking contrib.admin as an example, 404 messages should be translated.

Also marking this as a blocker because we should get translation strings sorted in the initial public version.

by szczav, 14 years ago

Attachment: patch2.diff added

comment:3 by szczav, 14 years ago

In second patch I translated all error messages in generic class views according to russellm's suggestion. I think that it would be good to do some additional tests for errors, but I don't have time to do it now.

comment:4 by Russell Keith-Magee, 14 years ago

milestone: 1.3
Triage Stage: AcceptedReady for checkin

This patch isn't strictly ready for checkin, because it's a superset of what is needed. However, I can distill what is needed from this patch. For posterity:

  • We're not going to add translation strings for deprecated features (i.e., old-style function based generics)
  • We don't need to translate InvalidConfiguration, TypeError and other internal errors. If a user ever sees these, there is something *badly* wrong. We only need to translate the 404s. This follows the pattern established by contrib.admin.

comment:5 by Russell Keith-Magee, 14 years ago

Resolution: fixed
Status: newclosed

In [15533]:

Fixed #15287 -- Added translation markers to user-facing error messages in class-based generic views. Thanks to szczav for the report and draft patch.

comment:6 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

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