Opened 8 years ago

Closed 8 years ago

#4359 closed (fixed)

[unicode] Translation errors in the admin

Reported by: anonymous Owned by: mtredinnick
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: UI/UX:

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 8 years ago.
unicode-default-list-display.diff (614 bytes) - added by anonymous 8 years ago.
unicode-escape-help-text.diff (1.9 KB) - added by anonymous 8 years ago.
unicode-deleted-objects.diff (1.1 KB) - added by anonymous 8 years ago.

Download all attachments as: .zip

Change History (11)

Changed 8 years ago by anonymous

comment:1 Changed 8 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Changed 8 years ago by anonymous

Changed 8 years ago by anonymous

Changed 8 years ago by anonymous

comment:2 Changed 8 years ago by anonymous

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 Changed 8 years ago by jacob

  • Owner changed from mtredinnick to malcolm
  • Summary changed from 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 to [unicode] Translation errors in the admin

comment:4 Changed 8 years ago by jacob

  • Owner changed from malcolm to mtredinnick

comment:5 Changed 8 years ago by mtredinnick

  • Keywords unicode-branch removed
  • Triage Stage changed from Unreviewed to Accepted

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 Changed 8 years ago by mtredinnick

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 Changed 8 years ago by mtredinnick

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

(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