Code

Opened 3 years ago

Closed 3 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

  1. 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.

Attachments (0)

Change History (2)

comment:1 Changed 3 years ago by ramiro

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

(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.

comment:2 Changed 3 years ago by claudep

  • Resolution set to wontfix
  • Status changed from new to closed

I was just going to close it as wont't fix. So just doing that !

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.