Language

    Attention

    The language detection filter is only included in contrib images

    Attention

    The language detection filter is experimental and is currently under active development.

    Attention

    The language detection filter does not work on Windows (the blocker is getting icu compiled).

    The language detection filter (i18n) picks the best match between the desired locales of a client and an application’s supported locales and adds a new header to the request containing an IETF BCP 47 language tag.

    The filter parses a list of locales from an Accept-Language header [RFC 2616 Section 14.4]() to match the desired locale of a client.

    • The client is from the Romandy region and prefers Swiss French, the variety of French spoken in the French-speaking area of Switzerland

    • The client sends an Accept-Language header

    • An header indicates the natural language and locale that the client prefers

    • The filter sets the value of the x-language header to fr

    When the filter can not match the desired locale of a client using the supported_languages option, the option will be used as a fallback. The header value will never be empty.

    Full filter configuration:

    The above configuration can be understood as follows:

    • Try to pick the client’s desired locale from an Accept-Language header

    Statistics

    The language detection filter outputs statistics in the http.<stat_prefix>.language. namespace. The | stat prefix comes from the owning HTTP connection manager.