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 runserver and runfcgi
That makes a real issue when we use some custom commands that uses i18n - for example, celery.
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:1 Changed 6 years ago by tonnzor
- Cc tonn81@… added
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:5 follow-up: ↓ 8 Changed 6 years ago by ramiro
- Summary changed from Always respect LANGUAGE_CODE to respect LANGUAGE_CODE in management command instead of overriding it with 'en-us'
comment:6 in reply to: ↑ description ; follow-ups: ↓ 7 ↓ 11 Changed 6 years ago by ramiro
- Triage Stage changed from Unreviewed to Design decision needed
comment:11 in reply to: ↑ 6 Changed 6 years ago by ramiro
- Resolution set to duplicate
- Status changed from new to closed