Changeset 7185
- Timestamp:
- 02/29/08 12:38:44 (9 months ago)
- Files:
-
- django/trunk/django/conf/global_settings.py (modified) (1 diff)
- django/trunk/django/utils/translation/trans_real.py (modified) (1 diff)
- django/trunk/django/views/i18n.py (modified) (1 diff)
- django/trunk/docs/i18n.txt (modified) (2 diffs)
- django/trunk/docs/settings.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/conf/global_settings.py
r7135 r7185 92 92 # to load the internationalization machinery. 93 93 USE_I18N = True 94 95 94 LOCALE_PATHS = () 95 LANGUAGE_COOKIE_NAME = 'django_language' 96 96 97 97 # Not-necessarily-technical managers of the site. They get broken link django/trunk/django/utils/translation/trans_real.py
r7091 r7185 356 356 return lang_code 357 357 358 lang_code = request.COOKIES.get( 'django_language')358 lang_code = request.COOKIES.get(settings.LANGUAGE_COOKIE_NAME) 359 359 if lang_code and lang_code in supported and check_for_language(lang_code): 360 360 return lang_code django/trunk/django/views/i18n.py
r6739 r7185 29 29 request.session['django_language'] = lang_code 30 30 else: 31 response.set_cookie( 'django_language', lang_code)31 response.set_cookie(settings.LANGUAGE_COOKIE_NAME, lang_code) 32 32 return response 33 33 django/trunk/docs/i18n.txt
r7059 r7185 548 548 * First, it looks for a ``django_language`` key in the the current user's 549 549 `session`_. 550 * Failing that, it looks for a cookie called ``django_language``.550 * Failing that, it looks for a cookie that is named according to your ``LANGUAGE_COOKIE_NAME`` setting (the default name is: ``django_language``). 551 551 * Failing that, it looks at the ``Accept-Language`` HTTP header. This 552 552 header is sent by your browser and tells the server which language(s) you … … 720 720 parameter set in request. If session support is enabled, the view 721 721 saves the language choice in the user's session. Otherwise, it saves the 722 language choice in a ``django_language`` cookie. 722 language choice in a cookie that is by default named ``django_language`` 723 (the name can be changed through the ``LANGUAGE_COOKIE_NAME`` setting). 723 724 724 725 After setting the language choice, Django redirects the user, following this django/trunk/docs/settings.txt
r6930 r7185 579 579 580 580 .. _internationalization docs: ../i18n/ 581 582 LANGUAGE_COOKIE_NAME 583 -------------------- 584 585 Default: ``'django_language'`` 586 587 The name of the cookie to use for the language cookie. This can be whatever 588 you want (but should be different from SESSION_COOKIE_NAME). See the 589 `internationalization docs`_ for details. 590 581 591 582 592 LANGUAGES … … 823 833 Default: ``'sessionid'`` 824 834 825 The name of the cookie to use for sessions. This can be whatever you want .826 See the `session docs`_.835 The name of the cookie to use for sessions. This can be whatever you want (but 836 should be different from ``LANGUAGE_COOKIE_NAME``). See the `session docs`_. 827 837 828 838 SESSION_COOKIE_PATH
