We've been making changes to how we organize and display our docs. Our work isn't done but we'd love your feedback.

accept.language_lookup()

Selects the best match from a string in the format of an Accept-Language header's value in the listed languages, using the algorithm described in RFC 4647, Section 3.4.

This function takes the following parameters:

  1. a colon-separated list of languages available for the resource,
  2. a fallback return value,
  3. a string representing an Accept-Language header's value.

This function conforms to RFC 4647.

Format

STRING
accept.language_lookup(STRING requested_languages, STRING default, STRING accept_header)

Examples

1
2
3
set bereq.http.Accept-Language =
  accept.language_lookup("en:de:fr:nl", "en",
    req.http.Accept-Language);