#7706: locale dir allowed in project dir, but views.i18n.javascript_catalog
filters it out
----------------------------------------------+-----------------------------
Reporter: robbyd | Owner: nobody
Status: new | Milestone:
Component: Translations | Version: SVN
Keywords: javascript_catalog, i18n, jsi18n | Stage: Unreviewed
Has_patch: 0 |
----------------------------------------------+-----------------------------
{{{
#!rst
Back again. I found what seems to be a bit of a design inconsistency.
According to `this link <http://www.djangoproject.com/documentation/i18n
/#using-translations-in-your-own-projects>`_, the ``locale`` dir
can be in the Django project directory (instead of being in a specific
django app directory). That's all fine and good, and that's how we do it
now.
Moreover, the docs `state <http://www.djangoproject.com/documentation/i18n
/#the-javascript-catalog-view>`_::
The main solution to these problems is the javascript_catalog view,
which sends out a JavaScript code library with functions
that mimic the gettext interface, plus an array of translation
strings. Those translation strings are taken from the application,
project or Django core, according to what you specify in either the
info_dict or the URL.
This lead me to believe that translations under the project dir would work
fine. So I began using the jsi18n view in our project, as:
.. code-block:: python
jsInfoDict = {
'packages': ('django.conf', 'bla.mydjangoproject'),
}
urlpatterns += patterns('',
(r'^jsi18n/$', 'django.views.i18n.javascript_catalog',
jsInfoDict),
)
We can get to the view fine, but our project's translations are not
showing up.
Going into the javascript_catalog code, I see that the problem seems to be
with the line ``124``:
.. code-block:: python
packages = [p for p in packages if p == 'django.conf' or p in
settings.INSTALLED_APPS]
As I want to use ``locales`` under the project dir, that is not put into
INSTALLED_APPS, as it's
not a django app (obviously). So unless I am totally missing something
here, this view needs
to be enhanced to not filter out (in addition to INSTALLED_APPS):
* The root project directory
* Possibly any path specified in settings.LOCALE_PATHS
If this is acceptable, I can provide a patch if need be. That
``javascript_catalog`` section's docs will need to be updated as well.
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/7706>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---