def get_lang_from_cookie(request, supported):
 from django.conf import settings
 lang_code = request.COOKIES.get(settings.LANGUAGE_COOKIE_NAME)
 if (lang_code and (lang_code in supported)):
  return lang_code
 return None

def get_lang_from_cookie ( request , supported ) : from django . conf import settings lang_code = request . COOKIES . get ( settings . LANGUAGE_COOKIE_NAME ) if ( lang_code and ( lang_code in supported ) ) : return lang_code return None
see if the users browser sent a cookie with a preferred language .