Opened 11 years ago

Closed 11 years ago

#5287 closed (fixed)

i18n marking breaks choices in admin on being marked for translation

Reported by: kenneth gonsalves <lawgon@…> Owned by: nobody
Component: Internationalization Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


when i upgraded to the latest svn head (6022) from 5036, I found that all the places in admin that had dropdowns for choices were blank. I had always marked my choices for translation like so:

article_type = (
("NW", _("News")),

now, this doesnt work - when I remove the _(), then the choices appear. I am using from django.utils.translation import gettext_lazy as _. I have reported this in the mailing list, but now feel it is a bug.

Change History (3)

comment:1 Changed 11 years ago by kenneth gonsalves <lawgon@…>

if i use 'import gettext as _' everything works. 'import ugettext_lazy as _' also doesnt work

comment:2 Changed 11 years ago by Malcolm Tredinnick

(In [6452]) Fixed a Python 2.3 Unicode + oldforms problem. Refs #5287.

comment:3 Changed 11 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

I can only duplicate this problem using python 2.3 and that's now been fixed.

If you are using 2.4 or 2.5 and it's still an issue, can you please reopen and give a small example demonstrating the problem. My test case so far has been this model (with _() bound to ugettext_lazy()):

CHOICES = (('a', _('a')), ('b', _('b')), ('c', _('c')))

class T5287(models.Model):
    type = models.CharField(max_length=5, choices=CHOICES)

    class Admin:

That displays correctly for me on current trunk (although not with python 2.3 prior to [6452]) and seems to follow your explanation of the problem.

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