bug 258246: RFC: Accept language header: 'en-gb' and matching

David Miller justdave at bugzilla.org
Sun Sep 12 21:50:56 UTC 2004

Gervase Markham wrote:

> David Miller wrote:
>> But that's not what the RFC says, and it's not how Apache works for 
>> the built-in content-negotiation it can do.
> But isn't it common-sense?
> Someone sends:
> Accept-Language: de-de, fr
> And we have a choice of de and en, with default as en. What would be the 
> sensible thing to serve them?

Going by the RFC (and mimicking Apache's behavior) we would send them en.

> Looking at it another way, what would break if we made this change?

 From RFC 1766: (language identification codes)

    There is no guaranteed relationship between languages whose tags
    start out with the same series of subtags; especially, they are NOT
    guraranteed to be mutually comprehensible, although this will
    sometimes be the case.

In otherwords, we can't depend on the presence of a generic "xx" to be 
compatible with "xx-yy"

RFC 1766 has actually been obsoleted by RFC 3066, which replaced the 
above paragraph with one identical to the first one I'm quoting from RFC 
2616 below.

 From RFC 2616: (HTTP/1.1) Section 14.4

       Note: This use of a prefix matching rule does not imply that
       language tags are assigned to languages in such a way that it is
       always true that if a user understands a language with a certain
       tag, then this user will also understand all languages with tags
       for which this tag is a prefix. The prefix rule simply allows the
       use of prefix tags if this is the case.


       Note: When making the choice of linguistic preference available to
       the user, we remind implementors of  the fact that users are not
       familiar with the details of language matching as described above,
       and should provide appropriate guidance. As an example, users
       might assume that on selecting "en-gb", they will be served any
       kind of English document if British English is not available. A
       user agent might suggest in such a case to add "en" to get the
       best matching behavior.

Dave Miller      Project Leader, Bugzilla Bug Tracking System
http://www.justdave.net/             http://www.bugzilla.org/

More information about the developers mailing list