diff options
| author | Ramiro Morales <cramm0@gmail.com> | 2013-08-22 08:25:21 -0300 |
|---|---|---|
| committer | Ramiro Morales <cramm0@gmail.com> | 2013-08-22 08:29:59 -0300 |
| commit | 26a4c835987d93f845cc2915d08780854a90c587 (patch) | |
| tree | a5fc2f48e8d127fdfbdf9a849e61a953f2b3c705 /docs | |
| parent | ff92a6eb5b87c65ca47568e0ca37df949e17feb2 (diff) | |
[1.6.x] Made description of LANGUAGE_CODE setting more clear.
297f5af222bde02a7cdd005da2e4b00ec81801de from master.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/settings.txt | 15 | ||||
| -rw-r--r-- | docs/topics/i18n/translation.txt | 13 |
2 files changed, 21 insertions, 7 deletions
diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt index 1916f6377f..46482b80a6 100644 --- a/docs/ref/settings.txt +++ b/docs/ref/settings.txt @@ -1257,11 +1257,22 @@ LANGUAGE_CODE Default: ``'en-us'`` -A string representing the language code for this installation. This should be -in standard :term:`language format<language code>`. For example, U.S. English +A string representing the language code for this installation. This should be in +standard :term:`language ID format <language code>`. For example, U.S. English is ``"en-us"``. See also the `list of language identifiers`_ and :doc:`/topics/i18n/index`. +:setting:`USE_I18N` must be active to this setting to have any effect. + +it serves two purposes: + +* If the locale middleware isn't in use, it decides which translation is served + to all users. +* If the locale middleware is active, it provides the fallback translation when + no translation exist for a given literal to the user preferred language. + +See :ref:`how-django-discovers-language-preference` for more details. + .. _list of language identifiers: http://www.i18nguy.com/unicode/language-identifiers.html .. setting:: LANGUAGE_COOKIE_NAME diff --git a/docs/topics/i18n/translation.txt b/docs/topics/i18n/translation.txt index e724837ce1..4052b50b07 100644 --- a/docs/topics/i18n/translation.txt +++ b/docs/topics/i18n/translation.txt @@ -1552,14 +1552,17 @@ should be used -- installation-wide, for a particular user, or both. To set an installation-wide language preference, set :setting:`LANGUAGE_CODE`. Django uses this language as the default translation -- the final attempt if no -other translator finds a translation. +better matching translation is found by one of the methods employed by the +locale middleware (see below). -If all you want to do is run Django with your native language, and a language -file is available for it, all you need to do is set :setting:`LANGUAGE_CODE`. +If all you want to do is run Django with your native language all you need to do +is set :setting:`LANGUAGE_CODE` and make sure the corresponding :term:`message +files <message file>` and their compiled versions (``.mo``) exist. If you want to let each individual user specify which language he or she -prefers, use ``LocaleMiddleware``. ``LocaleMiddleware`` enables language -selection based on data from the request. It customizes content for each user. +prefers, the you also need to use use the ``LocaleMiddleware``. +``LocaleMiddleware`` enables language selection based on data from the request. +It customizes content for each user. To use ``LocaleMiddleware``, add ``'django.middleware.locale.LocaleMiddleware'`` to your :setting:`MIDDLEWARE_CLASSES` setting. Because middleware order |
