Ticket #3640: i18n_set_language.diff
File i18n_set_language.diff, 924 bytes (added by , 18 years ago) |
---|
-
django/views/i18n.py
9 9 """ 10 10 Redirect to a given url while setting the chosen language in the 11 11 session or cookie. The url and the language code need to be 12 specified in the GET param ters.12 specified in the GET parameters. 13 13 """ 14 lang_code = request.GET ['language']14 lang_code = request.GET.get('language', None) 15 15 next = request.GET.get('next', None) 16 16 if not next: 17 17 next = request.META.get('HTTP_REFERER', None) 18 18 if not next: 19 19 next = '/' 20 20 response = http.HttpResponseRedirect(next) 21 if check_for_language(lang_code):21 if lang_code and check_for_language(lang_code): 22 22 if hasattr(request, 'session'): 23 23 request.session['django_language'] = lang_code 24 24 else: