- Content negotiation functions
- accept
.charset_lookup() - accept
.encoding_lookup() - accept
.language_filter_basic() - accept
.language_lookup() - accept
.media_lookup()
accept.language_filter_basic()
Similar to accept.language_lookup()
, this function selects the best matches 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.3.1.
This function takes the following parameters:
- a colon-separated list of languages available for the resource,
- a fallback return value,
- a string representing an
Accept-Language
header's value, - the maximum number of matching languages to return.
The matches are comma-separated.
Format
STRING
accept.language_filter_basic(STRING requested_languages, STRING default, STRING accept_header, INTEGER nmatches)
Examples
1
2
3
set bereq.http.Accept-Language =
accept.language_filter_basic("en:de:fr:nl", "nl",
req.http.Accept-Language, 2);