Opened 16 years ago

Closed 14 years ago

#8124 closed (wontfix)

Proposal: load translations from settings.TEMPLATE_DIRS

Reported by: Joost Cassee Owned by: nobody
Component: Internationalization Version: dev
Severity: Keywords:
Cc: joost@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Template paths from settings.TEMPLATE_DIRS are not always (often not?) located within the Python project directory. These directories contain site-wide templates that may contain i18n strings that should be translated. It makes sense to locate the message catalogs for these string with the templates. I propose the following additional convention for translations:

  • Look for a locale directory in every path in settings.TEMPLATE_DIRS. If Django finds a translation, the translation will be installed.

This set-up is already possible by setting settings.LOCALE_PATHS, but this ticket is about proposing a new convention for templates.

If this ticket is accepted I am willing to do the patch.

Change History (6)

comment:1 by Joost Cassee, 16 years ago

As a reference, automatically getting translations from template directories requires the following in settings:

LOCALE_PATHS = []
for path in TEMPLATE_DIRS:
    LOCALE_PATHS.append(path + '/locale')
LOCALE_PATHS = tuple(LOCALE_PATHS)

(The conversion to a tuple is necessary to avoid an error in compile_messages.)

comment:2 by Jeff Anderson, 16 years ago

Triage Stage: UnreviewedDesign decision needed

comment:3 by Malcolm Tredinnick, 16 years ago

milestone: post-1.0
Triage Stage: Design decision neededAccepted

We should fix that requirement to convert to a tuple. Would you mind to open a ticket for that? It's not a very nice requirements.

The proposal itself looks reasonable. It's something for after 1.0, however.

comment:4 by (none), 16 years ago

milestone: post-1.0

Milestone post-1.0 deleted

comment:5 by Ramiro Morales, 14 years ago

I'm not convinced standalone templates with associated translations are a common enough deployment scenario to justify adding even another path setting to the list of locations translations will be searched for at runtime.

Isn't enough that this requirement can be solved by using the Python code snippet described in comment:1 in the settings module of projects needing something like this?

in reply to:  5 comment:6 by Joost Cassee, 14 years ago

Resolution: wontfix
Status: newclosed

Replying to ramiro:

I'm not convinced standalone templates with associated translations are a common enough deployment scenario to justify adding even another path setting to the list of locations translations will be searched for at runtime.

I usually bundle translation files with templates in private projects. If this is not a common practice, let's close this ticket.

Note: See TracTickets for help on using tickets.
Back to Top