mirror of https://github.com/django/django.git
LocaleMiddleware isn't default anymore
Changed in @23229061fcb836ecca2195cc75f91e331279a5d1
This commit is contained in:
parent
2fc6c9472c
commit
cf6c754629
|
@ -29,9 +29,7 @@ use internationalization, you should take the two seconds to set
|
||||||
:setting:`USE_I18N = False <USE_I18N>` in your settings file. Then Django will
|
:setting:`USE_I18N = False <USE_I18N>` in your settings file. Then Django will
|
||||||
make some optimizations so as not to load the internationalization machinery.
|
make some optimizations so as not to load the internationalization machinery.
|
||||||
You'll probably also want to remove ``'django.core.context_processors.i18n'``
|
You'll probably also want to remove ``'django.core.context_processors.i18n'``
|
||||||
from your :setting:`TEMPLATE_CONTEXT_PROCESSORS` setting and
|
from your :setting:`TEMPLATE_CONTEXT_PROCESSORS` setting.
|
||||||
``'django.middleware.locale.LocaleMiddleware'`` from your
|
|
||||||
:setting:`MIDDLEWARE_CLASSES` setting.
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
|
@ -1563,15 +1561,9 @@ If you want to let each individual user specify which language he or she
|
||||||
prefers, use ``LocaleMiddleware``. ``LocaleMiddleware`` enables language
|
prefers, use ``LocaleMiddleware``. ``LocaleMiddleware`` enables language
|
||||||
selection based on data from the request. It customizes content for each user.
|
selection based on data from the request. It customizes content for each user.
|
||||||
|
|
||||||
``LocaleMiddleware`` is enabled in the default settings file: the
|
To use ``LocaleMiddleware``, add ``'django.middleware.locale.LocaleMiddleware'``
|
||||||
:setting:`MIDDLEWARE_CLASSES` setting contains
|
to your :setting:`MIDDLEWARE_CLASSES` setting. Because middleware order
|
||||||
``'django.middleware.locale.LocaleMiddleware'``.
|
matters, you should follow these guidelines:
|
||||||
|
|
||||||
.. versionchanged:: 1.6
|
|
||||||
|
|
||||||
In previous versions, ``LocaleMiddleware`` wasn't enabled by default.
|
|
||||||
|
|
||||||
Because middleware order matters, you should follow these guidelines:
|
|
||||||
|
|
||||||
* Make sure it's one of the first middlewares installed.
|
* Make sure it's one of the first middlewares installed.
|
||||||
* It should come after ``SessionMiddleware``, because ``LocaleMiddleware``
|
* It should come after ``SessionMiddleware``, because ``LocaleMiddleware``
|
||||||
|
|
Loading…
Reference in New Issue