Opened 13 years ago
Closed 13 years ago
#17509 closed Bug (wontfix)
Project-level locale directory is not found when project is in a nested module
Reported by: | anonymous | Owned by: | nobody |
---|---|---|---|
Component: | Internationalization | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Design decision needed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
We have a Django project in a nested module structure, it looks something like this:
company.app.something.django_project
So our project-level locale is in
company/app/something/django_project/locale/
And settings.py is:
company/app/something/django_project/settings.py
The documentation states:
From: https://docs.djangoproject.com/en/dev/topics/i18n/translation/#how-django-discovers-translations
- Then, it looks for a locale directory in the project directory, or more accurately, in the directory containing your settings file.
But the code takes the first level of the module structure:
See: https://code.djangoproject.com/browser/django/tags/releases/1.3.1/django/utils/translation/__init__.py#L48
Therefore the locale directory is being looked for here:
company/locale/
There is a workaround in that the path can be explicitly set in settings.LOCALE_PATHS.
Change History (2)
comment:1 by , 13 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:2 by , 13 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
I was just going to close it as wont't fix. So just doing that !
(See also https://code.djangoproject.com/browser/django/tags/releases/1.3.1/django/utils/translation/trans_real.py#L116)
That's precisely the reason why deprecatd the project-level locale directory concept in 1.3. See https://docs.djangoproject.com/en/1.3/releases/1.3/#loading-of-project-level-translations
I don't think it would be worth fixing this for Django > 1.3 since we are going to remove this support completely in Django 1.5 (or more precisely, Django 1.3 + 2) and, as per our backports policy, an hypothetical fix wouldn't ever reach 1.3.x (the version the OP is using).
Suggestion for the OP: Stop using the project-level locale and swtich to lisitng thedirectory in LOCALE_PATHS as you've already discovered.
Setting design decision needed to get more opinions.