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 insettings.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 , 16 years ago
comment:2 by , 16 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:3 by , 16 years ago
milestone: | → post-1.0 |
---|---|
Triage Stage: | Design decision needed → Accepted |
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.
follow-up: 6 comment:5 by , 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?
comment:6 by , 14 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
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.
As a reference, automatically getting translations from template directories requires the following in
settings
:(The conversion to a tuple is necessary to avoid an error in
compile_messages
.)