#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)
Change History (11)
comment:1 by , 16 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
by , 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 , 16 years ago
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
Version: | 0.96 → SVN |
comment:3 by , 16 years ago
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
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 , 16 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
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 , 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'.)
comment:6 by , 16 years ago
milestone: | → 1.0 |
---|---|
Owner: | changed from | to
Status: | reopened → new |
Triage Stage: | Unreviewed → Accepted |
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 , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:8 by , 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.
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.