Commit d162438c authored by Tim Graham's avatar Tim Graham
Browse files

[1.8.x] Fixed Sphinx highlight warnings in docs.

Backport of 9c43d825 from master
parent 7b6ab288
Loading
Loading
Loading
Loading
+6 −12
Original line number Diff line number Diff line
@@ -70,8 +70,6 @@ as a shorter alias, ``_``, to save typing.
       global ``_()`` function causes interference. Explicitly importing
       ``ugettext()`` as ``_()`` avoids this problem.

.. highlightlang:: python

In this example, the text ``"Welcome to my site."`` is marked as a translation
string::

@@ -1158,6 +1156,8 @@ Additionally, if there are complex rules around pluralization, the catalog view
will render a conditional expression. This will evaluate to either a ``true``
(should pluralize) or ``false`` (should **not** pluralize) value.

.. highlightlang:: python

Note on performance
-------------------

@@ -1269,8 +1269,8 @@ After defining these URL patterns, Django will automatically add the
language prefix to the URL patterns that were added by the ``i18n_patterns``
function. Example::

    from django.core.urlresolvers import reverse
    from django.utils.translation import activate
    >>> from django.core.urlresolvers import reverse
    >>> from django.utils.translation import activate

    >>> activate('en')
    >>> reverse('sitemap-xml')
@@ -1327,8 +1327,8 @@ After you've created the translations, the
:func:`~django.core.urlresolvers.reverse` function will return the URL in the
active language. Example::

    from django.core.urlresolvers import reverse
    from django.utils.translation import activate
    >>> from django.core.urlresolvers import reverse
    >>> from django.utils.translation import activate

    >>> activate('en')
    >>> reverse('news:category', kwargs={'slug': 'recent'})
@@ -1624,8 +1624,6 @@ translation utilities with a ``gettext`` package if the command ``xgettext
Customizing the ``makemessages`` command
----------------------------------------

.. highlightlang:: python

If you want to pass additional parameters to ``xgettext``, you need to create a
custom :djadmin:`makemessages` command and override its ``xgettext_options``
attribute::
@@ -1664,8 +1662,6 @@ Miscellaneous
The ``set_language`` redirect view
----------------------------------

.. highlightlang:: python

.. currentmodule:: django.views.i18n

.. function:: set_language(request)
@@ -1728,8 +1724,6 @@ redirected in the ``redirect_to`` context variable.
Explicitly setting the active language
--------------------------------------

.. highlightlang:: python

You may want to set the active language for the current session explicitly. Perhaps
a user's language preference is retrieved from another system, for example.
You've already been introduced to :func:`django.utils.translation.activate()`. That
+2 −1
Original line number Diff line number Diff line
@@ -29,7 +29,8 @@ which are particularly dangerous to HTML. While this protects users from most
malicious input, it is not entirely foolproof. For example, it will not
protect the following:

.. code-block:: html+django
.. code-block:: text
..   highlighting as html+django fails due to intentionally missing quotes.

    <style class={{ var }}>...</style>