summaryrefslogtreecommitdiff
path: root/docs/topics
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-05-09 04:25:34 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-05-09 04:25:34 +0000
commit3341f39f412fac95f42cf84e1f58a925b0e32bdc (patch)
tree3d4fcb0a7a3cc083ec06d98373f678f6ebe87d3c /docs/topics
parent5a2324afb2f46e86b2e61b2ae983b09715d13891 (diff)
Fixed #13417 -- Clarified the use of the djangojs domain for translation. Thanks to stephaner for the report and initial patch, and Ramiro Morales for his additional markup.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13147 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/topics')
-rw-r--r--docs/topics/i18n/internationalization.txt21
1 files changed, 15 insertions, 6 deletions
diff --git a/docs/topics/i18n/internationalization.txt b/docs/topics/i18n/internationalization.txt
index fce2a2d8c5..2788f05bdf 100644
--- a/docs/topics/i18n/internationalization.txt
+++ b/docs/topics/i18n/internationalization.txt
@@ -449,11 +449,15 @@ JavaScript.
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.
+.. module:: django.views.i18n
+
+.. function:: javascript_catalog(request, domain='djangojs', packages=None)
+
+The main solution to these problems is the :meth:`django.views.i18n.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.
You hook it up like this::
@@ -471,6 +475,9 @@ that contains a ``locale`` directory. If you specify multiple packages, all
those catalogs are merged into one catalog. This is useful if you have
JavaScript that uses strings from different applications.
+By default, the view uses the ``djangojs`` gettext domain. This can be
+changed by altering the ``domain`` argument.
+
You can make the view dynamic by putting the packages into the URL pattern::
urlpatterns = patterns('',
@@ -541,7 +548,9 @@ to produce proper pluralizations).
The ``set_language`` redirect view
==================================
-As a convenience, Django comes with a view, ``django.views.i18n.set_language``,
+.. function:: set_language(request)
+
+As a convenience, Django comes with a view, :meth:`django.views.i18n.set_language`,
that sets a user's language preference and redirects back to the previous page.
Activate this view by adding the following line to your URLconf::