diff --git a/docs/topics/i18n/translation.txt b/docs/topics/i18n/translation.txt index 7f6de9e384..70a312f7f2 100644 --- a/docs/topics/i18n/translation.txt +++ b/docs/topics/i18n/translation.txt @@ -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 diff --git a/docs/topics/security.txt b/docs/topics/security.txt index 62be131145..b3639baca4 100644 --- a/docs/topics/security.txt +++ b/docs/topics/security.txt @@ -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.