def get_lang_from_http_header(request, supported):
 accept = request.META.get('HTTP_ACCEPT_LANGUAGE', '')
 for (accept_lang, __) in trans_real.parse_accept_lang_header(accept):
  if (accept_lang == '*'):
   return None
  normalized = data.normalize_code(data.simplify_to_common(accept_lang))
  if (normalized in ['en-us', 'en']):
   return None
  if (normalized in supported):
   return normalized
  for lang in supported.keys():
   if (normalized == data.normalize_code(lang)):
    return lang
 return None

def get_lang_from_http_header ( request , supported ) : accept = request . META . get ( 'HTTP_ACCEPT_LANGUAGE' , '' ) for ( accept_lang , __ ) in trans_real . parse_accept_lang_header ( accept ) : if ( accept_lang == '*' ) : return None normalized = data . normalize_code ( data . simplify_to_common ( accept_lang ) ) if ( normalized in [ 'en-us' , 'en' ] ) : return None if ( normalized in supported ) : return normalized for lang in supported . keys ( ) : if ( normalized == data . normalize_code ( lang ) ) : return lang return None
if the users browser sends a list of preferred languages in the http_accept_language header .