#NEWLINE# def process_request( self , request ) : #NEWLINE# #INDENT# ( locale , path ) = utils . strip_path ( request . path_info ) #NEWLINE# if ( localeurl_settings . USE_SESSION and ( not locale ) ) : #NEWLINE# #INDENT# slocale = request . session . get ( 'django_language' ) #NEWLINE# if ( slocale and utils . supported_language ( slocale ) ) : #NEWLINE# #INDENT# locale = slocale #NEWLINE# #UNINDENT# #UNINDENT# if ( localeurl_settings . USE_ACCEPT_LANGUAGE and ( not locale ) ) : #NEWLINE# #INDENT# accept_lang_header = request . META . get ( 'HTTP_ACCEPT_LANGUAGE' , '' ) #NEWLINE# header_langs = parse_accept_lang_header ( accept_lang_header ) #NEWLINE# accept_langs = [ l for l in ( utils . supported_language ( lang [ 0 ] ) for lang in header_langs ) if l ] #NEWLINE# if accept_langs : #NEWLINE# #INDENT# locale = accept_langs [ 0 ] #NEWLINE# #UNINDENT# #UNINDENT# locale_path = utils . locale_path ( path , locale ) #NEWLINE# if ( locale_path . lower ( ) != request . path_info . lower ( ) ) : #NEWLINE# #INDENT# locale_url = utils . add_script_prefix ( locale_path ) #NEWLINE# qs = request . META . get ( 'QUERY_STRING' , '' ) #NEWLINE# if qs : #NEWLINE# #INDENT# locale_url = ( '%s?%s' % ( locale_path . encode ( 'utf-8' ) , qs ) ) #NEWLINE# #UNINDENT# redirect_class = HttpResponsePermanentRedirect #NEWLINE# if ( not localeurl_settings . LOCALE_REDIRECT_PERMANENT ) : #NEWLINE# #INDENT# redirect_class = HttpResponseRedirect #NEWLINE# #UNINDENT# return redirect_class ( iri_to_uri ( locale_url ) ) #NEWLINE# #UNINDENT# request . path_info = path #NEWLINE# if ( not locale ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# locale = request . LANGUAGE_CODE #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# locale = settings . LANGUAGE_CODE #NEWLINE# #UNINDENT# #UNINDENT# translation . activate ( locale ) #NEWLINE# request . LANGUAGE_CODE = translation . get_language ( )