respect LANGUAGE_CODE in management command instead of overriding it with 'en-us'
|Reported by:||tonnzor||Owned by:|
|Component:||Core (Management commands)||Version:||master|
|Cc:||tonn81@…||Triage Stage:||Design decision needed|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
For now settings.LANGUAGE_CODE is not used at all for all tasks except
That makes a real issue when we use some custom commands that uses i18n - for example,
Investigating that I found that code in
django/core/management/base.py:202 (ommited useless details):
# Switch to English, because django-admin.py creates database content # like permissions, and those shouldn't contain any translations. from django.utils import translation translation.activate('en-us')
First of all - this assumption is invalid - nothing broken when I created tables (including permissions) after disabling this code.
Then - even DB creation must respect selected locale. If I have a project in Russian and generate database having Russian locale - it should really use it.
After I disabled it - everything works fine
I can provide patch if needed.
Change History (12)
comment:5 follow-up: 8 Changed 6 years ago by
|Summary:||Always respect LANGUAGE_CODE → respect LANGUAGE_CODE in management command instead of overriding it with 'en-us'|