Opened 16 years ago

Closed 16 years ago

Last modified 12 years ago

#8702 closed (fixed)

words not i18n-ized in admin interface when use '--noreload' option.

Reported by: hank Owned by: Malcolm Tredinnick
Component: contrib.admin Version: dev
Severity: Keywords: admin i18n
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I use development server and start it with '--noreload' option. When I enter admin page, all words but strings in my models.py are not i18n-ized.
I18n is ok without '--noreload' option.

Attachments (2)

prj.tar.gz (6.8 KB ) - added by hankhu2001@… 16 years ago.
My test project. Execute run.bat and open http://localhost:8080/admin, user/pass='hank'/'123'
setlang.diff (550 bytes ) - added by Karen Tracey 16 years ago.
Patch, in case it's of use to anyone

Download all attachments as: .zip

Change History (11)

comment:1 by Malcolm Tredinnick, 16 years ago

Resolution: worksforme
Status: newclosed

Seems to work fine on trunk. We've fixed a few loading problems with the translation stuff in between 0.96 and now, so there's a reasonable chance it has been fixed in the interim.

by hankhu2001@…, 16 years ago

Attachment: prj.tar.gz added

My test project. Execute run.bat and open http://localhost:8080/admin, user/pass='hank'/'123'

comment:2 by hankhu2001@…, 16 years ago

Resolution: worksforme
Status: closedreopened
Version: 0.96SVN

comment:3 by Malcolm Tredinnick, 16 years ago

Resolution: invalid
Status: reopenedclosed

You don't have the LocaleMiddleware installed in your settings, so the internationalization infrastructure isn't enabled. When I include that middleware, it works fine. If you're still having problems with this, please ask on the django-users mailing list. This really isn't a bug in Django.

comment:4 by arien, 16 years ago

Resolution: invalid
Status: closedreopened

The bug is this one: the settings file has LANGUAGE_CODE = 'zh-cn' so the admin site should be displayed in Simplified Chinese, but it isn't when the --noreload option is used.

comment:5 by Karen Tracey, 16 years ago

It's because of the translation.activate('en-us') done in django/core/management/base.py's execute(). A way to fix it is to put:

            from django.conf import settings
            from django.utils import translation
            translation.activate(settings.LANGUAGE_CODE)

before the call to inner_run() on the else leg of if use_reloader in django/core/management/commands/runserver.py's handle() method. Sort of an edge case, but it does explain to me why setting LANGUAGE_CODE in settings.py never worked when running under a debugger that needed --noreload.

(A better way might be to only do the English activation when really necessary, but I don't know what set of things to check for to determine 'really necessary'.)

by Karen Tracey, 16 years ago

Attachment: setlang.diff added

Patch, in case it's of use to anyone

comment:6 by Malcolm Tredinnick, 16 years ago

milestone: 1.0
Owner: changed from nobody to Malcolm Tredinnick
Status: reopenednew
Triage Stage: UnreviewedAccepted

Okay, sorry to all for the confusion on my part. Arien smacked me around on IRC and got me to see what the real issue was. This fix looks sufficiently isolated that we can consider it for 1.0.

comment:7 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: newclosed

(In [8749]) Fixed #8702 -- Set up the initial locale correctly for the development server.
Previously, "--noreload" wasn't picking up the default language setting. Thanks
to arien and Karen Tracey for debugging this.

comment:8 by Malcolm Tredinnick, 16 years ago

I ended up putting the activate() call inside run_inner() because it seems almost accidental that it works in the autoreload case and I didn't want that to strangely stop working at some point in the future.

comment:9 by Jacob, 12 years ago

milestone: 1.0

Milestone 1.0 deleted

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