Opened 18 years ago

Closed 18 years ago

#4359 closed (fixed)

[unicode] Translation errors in the admin

Reported by: anonymous Owned by: Malcolm Tredinnick
Component: Internationalization Version: other branch
Severity: Keywords: admin
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If I use admin application with unicode branch and LANGUAGE is different from django_language session variable, I have these problems:

Models in auth application are not localized - I think ugettext_lazy should by used for them. It can be solved for example by unicode-lazy-auth.diff patch.

If I apply this patch, new problems appear:

List of groups has bad header - not translation of word "group", but only django.utils.functional.proxy object. It can be solved for example by unicode-default-list-display.diff patch.

Help texts doesn't work - again django.utils.functional.proxy object is rendered. It can be solved for example by unicode-escape-help-text.diff patch.

List of deleted objects doesn'work - - again django.utils.functional.proxy object is rendered. It can be solved for example by unicode-deleted-objects.diff patch. (It happens also when I delete instance of django.contrib.admin.models.Site, so it doesn't depends on the first patch.)

Attachments (4)

unicode-lazy-auth.diff (741 bytes ) - added by anonymous 18 years ago.
unicode-default-list-display.diff (614 bytes ) - added by anonymous 18 years ago.
unicode-escape-help-text.diff (1.9 KB ) - added by anonymous 18 years ago.
unicode-deleted-objects.diff (1.1 KB ) - added by anonymous 18 years ago.

Download all attachments as: .zip

Change History (11)

by anonymous, 18 years ago

Attachment: unicode-lazy-auth.diff added

comment:1 by anonymous, 18 years ago

by anonymous, 18 years ago

by anonymous, 18 years ago

by anonymous, 18 years ago

comment:2 by anonymous, 18 years ago

The summary should be "unicode-branch - something is too lazy and something is not lazy enough". I am sorry, I don't know how to change it.

comment:3 by Jacob, 18 years ago

Owner: changed from Malcolm Tredinnick to malcolm
Summary: unicode-branch - something is too lazy and something is not lazy enough If I use admin application with unicode branch and LANGUAGE is different from django_language session variable, I have these problems: Models in auth application are not localized - I think ugettext_lazy should by used for them. It can be solved for example by unicode-lazy-auth.diff patch. If I apply this patch, new problems appear: List of groups has bad header - not translation of word "group", but only django.utils.functional.__proxy__ object. It can be solved for example by unicode-default-list-display.diff patch. Help texts doesn't work - again django.utils.functional.__proxy__ object is rendered. It can be solved for example by unicode-escape-help-text.diff patch. unicode-branch - something is too lazy and something is not lazy enough[unicode] Translation errors in the admin

comment:4 by Jacob, 18 years ago

Owner: changed from malcolm to Malcolm Tredinnick

comment:5 by Malcolm Tredinnick, 18 years ago

Keywords: unicode-branch removed
Triage Stage: UnreviewedAccepted

In future, please file separate tickets for separate bugs; it makes it much easier to address things on a case-by-case basis.

Thanks for the report and attempts at fixes, though. It gives me a good of where to look.

  • The first patch is correct.
  • The second patch is the right idea, but needs a little tweaking (because the model might not have a __unicode__ method.
  • The third patch is wrong, because help_text can contains links, etc, so should not be escaped. I'll fix it in another way.
  • The fourth patch is correct.

comment:6 by Malcolm Tredinnick, 18 years ago

The second patch was correct -- clearly the original submitter understands the code much better than I do. Third problem was indicative of a larger problem with resolve_variable() and the fourth problem was just a matter of coercing things to unicode correctly.

comment:7 by Malcolm Tredinnick, 18 years ago

Resolution: fixed
Status: newclosed

(In [5320]) unicode: Fixed a number of problems where lazily translated objects were not
being converted back to unicode strings correctly. Fixed #4359 and #4361.

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