1
0
mirror of https://github.com/django/django.git synced 2025-07-04 09:49:12 +00:00

[1.2.X] Tweaked language markers in i18n topic document for better Sphinx syntax highlighting.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15442 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Ramiro Morales 2011-02-07 19:50:07 +00:00
parent 5f0ed3e198
commit 1406265e17

View File

@ -291,8 +291,6 @@ translation method!
Working with lazy translation objects Working with lazy translation objects
------------------------------------- -------------------------------------
.. highlightlang:: python
Using ``ugettext_lazy()`` and ``ungettext_lazy()`` to mark strings in models Using ``ugettext_lazy()`` and ``ungettext_lazy()`` to mark strings in models
and utility functions is a common operation. When you're working with these and utility functions is a common operation. When you're working with these
objects elsewhere in your code, you should ensure that you don't accidentally objects elsewhere in your code, you should ensure that you don't accidentally
@ -507,6 +505,8 @@ string, so they don't need to be aware of translations.
Specifying translation strings: In JavaScript code Specifying translation strings: In JavaScript code
================================================== ==================================================
.. highlightlang:: python
Adding translations to JavaScript poses some problems: Adding translations to JavaScript poses some problems:
* JavaScript code doesn't have access to a ``gettext`` implementation. * JavaScript code doesn't have access to a ``gettext`` implementation.
@ -568,7 +568,11 @@ catalog file. As a security measure, these values can only be either
Using the JavaScript translation catalog Using the JavaScript translation catalog
---------------------------------------- ----------------------------------------
To use the catalog, just pull in the dynamically generated script like this:: .. highlightlang:: javascript
To use the catalog, just pull in the dynamically generated script like this:
.. code-block:: html+django
<script type="text/javascript" src="{% url django.views.i18n.javascript_catalog %}"></script> <script type="text/javascript" src="{% url django.views.i18n.javascript_catalog %}"></script>
@ -623,6 +627,8 @@ to produce proper pluralizations).
The ``set_language`` redirect view The ``set_language`` redirect view
================================== ==================================
.. highlightlang:: python
.. function:: set_language(request) .. function:: set_language(request)
As a convenience, Django comes with a view, :meth:`django.views.i18n.set_language`, As a convenience, Django comes with a view, :meth:`django.views.i18n.set_language`,