From e3389f9a203cf0a55936a0c9f766b5d6f7b778a8 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Sun, 9 May 2010 04:34:13 +0000 Subject: [PATCH] [1.1.X] 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. Backport of r13147 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@13152 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/topics/i18n/internationalization.txt | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/docs/topics/i18n/internationalization.txt b/docs/topics/i18n/internationalization.txt index 41b9811971..e6c9dae2bf 100644 --- a/docs/topics/i18n/internationalization.txt +++ b/docs/topics/i18n/internationalization.txt @@ -447,11 +447,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:: @@ -469,6 +473,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('', @@ -539,7 +546,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::