negotiator

Locale negotiator.

pyramid_localize.negotiator.locale_negotiator(request)[source]

Locale negotiator.

It sets best suited locale variable for given user:

  1. Check for presence and value of request._LOCALE_ value
  2. Then tries the address url, if the first part has locale indicator.
  3. It checks cookies, for value set here
  4. Tries to best match accepted language for browser user is visiting
    website with
  5. Defaults to localize.locales.default configuration setting value
Parameters:request (pyramid.request.Request) – a request object
Returns:locale name
Return type:str