parameters: (self, default: str = "en_US")
return_statement: return locale.get(default)
docstring: Determines the user's locale from ``Accept-Language`` header.
  
          See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4
docstring_summary: Determines the user's locale from ``Accept-Language`` header.
docstring_tokens: Determines the user s locale from Accept - Language header .
function: def get_browser_locale(self, default: str = "en_US") -> tornado.locale.Locale:
          """Determines the user's locale from ``Accept-Language`` header.
  
          See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4
          """
          if "Accept-Language" in self.request.headers:
              languages = self.request.headers["Accept-Language"].split(",")
              locales = []
              for language in languages:
                  parts = language.strip().split(";")
                  if len(parts) > 1 and parts[1].startswith("q="):
                      try:
                          score = float(parts[1][2:])
                      except (ValueError, TypeError):
                          score = 0.0
                  else:
                      score = 1.0
                  locales.append((parts[0], score))
              if locales:
                  locales.sort(key=lambda pair: pair[1], reverse=True)
                  codes = [loc[0] for loc in locales]
                  return locale.get(*codes)
          return locale.get(default)
function_tokens: def get_browser_locale ( self , default : str = "en_US" ) -> tornado . locale . Locale : if "Accept-Language" in self . request . headers : languages = self . request . headers [ "Accept-Language" ] . split ( "," ) locales = [ ] for language in languages : parts = language . strip ( ) . split ( ";" ) if len ( parts ) > 1 and parts [ 1 ] . startswith ( "q=" ) : try : score = float ( parts [ 1 ] [ 2 : ] ) except ( ValueError , TypeError ) : score = 0.0 else : score = 1.0 locales . append ( ( parts [ 0 ] , score ) ) if locales : locales . sort ( key = lambda pair : pair [ 1 ] , reverse = True ) codes = [ loc [ 0 ] for loc in locales ] return locale . get ( * codes ) return locale . get ( default )