#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)
Change History (8)
by , 15 years ago
| Attachment: | patch.diff added |
|---|
comment:1 by , 15 years ago
| Has patch: | set |
|---|
comment:2 by , 15 years ago
| Keywords: | blocker added |
|---|---|
| Patch needs improvement: | set |
| Triage Stage: | Unreviewed → Accepted |
by , 15 years ago
| Attachment: | patch2.diff added |
|---|
comment:3 by , 15 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 , 15 years ago
| milestone: | → 1.3 |
|---|---|
| Triage Stage: | Accepted → Ready 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.
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.