Accept-Language

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
David Latapie's picture

How to change content according to browser language?

Scenario:

I own a website in French. Someone from the UK visits my website (with an English browser of course). Drupal recognizes its language and serves the English version of the page.

How to do this ?

Content-negociation based on the browser language (Accept-Language in Apache terms, but I don't know it has any importance with Drupal, I think). That seems pretty basic to me, bt I may be wrong (I am not a coder).

<

ul>

  • Does Locale (core) suffices or do I need an extra module? If yes, which one? i18n?
  • Read more
    aaron's picture

    Accept-Language Header Field?

    I'm curious about how the Accept-language header field works, as outlined at http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html and if we could take advantage of that with i18n. My understanding is that the browser would send its preferred language(s) through the get header, so the server could parse that and return an appropriate page.

    An example of this is given at http://www.w3.org/TR/cooluris/#conneg

    GET /people/alice HTTP/1.1
    Host: www.example.com
    Accept: text/html, application/xhtml+xml
    Accept-Language: en, de

    might return:

    HTTP/1.1 200 OK

    Read more
    Subscribe with RSS Syndicate content