Forum Moderators: phranque

Message Too Old, No Replies

Accept-Language HTTP header - problems?

         

tedster

12:43 pm on Sep 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can any problems be caused by using the Accept-Language HTTP header if the server actually does no content negotiation? Might some user agents be shut out, or is it not an issue?

isitreal

5:16 pm on Sep 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



why not just use a default:

if ( isset( $_SERVER["HTTP_ACCEPT_LANGUAGE"] ) )
{
statements;
}
else
{
default behavior;
}

tedster

9:54 pm on Sep 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Because this is an IIS6 server where I know next to nothing, and because it is a client site where I have only indirect access to the sys admin at present, I'm trying to discover if there is a problem here that I should address (the client does want English as a Second Language traffic) -- or if it's just no big deal. What I read is confusing to me.

Parts of the site that are currently under development will eventually include 12 different languages, although for the moment there is only English.

So I am asking them to set the Content-Language header - which is currently not configured, but Accept-Langauge is. Because my communications channel to the sys admin is barely stitched together, I want to discover if I should address the Accept-Language issue in the same communication. I may only get one chance!

drbrain

10:58 pm on Sep 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I suggest you read the Apache content negotiation docs, even though you aren't working with Apache and sections 14.4 and 14.12 of RFC 2616 (HTTP/1.1):

[httpd.apache.org...]

ftp://ftp.rfc-editor.org/in-notes/rfc2616.txt

There are two parts to language negotiation. Accept-Language is used to indicate which languages are prefered. Content-Language is used to indicate the intended audience of the entity is. (Note that these headers can be used on both the client and server side.)

You will send the browser a Content-Language header matching the language of the document. The browsers send you an Accept-Language header indicating which languages they prefer. If they don't send an Accept-Language header, you'll have to provide some kind of default page.

You should match up the browser's Accept-Language header to what documents you have available, and should set the appropriate Content-Language header for documents you send. If you've got a Danish/English site, and the user requests Danish (Accept-Language: da, en;q=0.8), you give them Danish (Content-Language: da. If they request Swahili, you pick a reasonable alternative. If you have a document intended for a multi-lingual audience (the French constitution?) you set both languages (Content-Language: en-CA, fr-CA).

The browser may send you a Content-Language header if they POST you data. You may send the browser an Accept-Language header indicating what languages you would like information to be POSTed in. (I doubt you'll find a browser that does anything with an incoming Accept-Language or sends an outgoing Content-Language header, though.)

tedster

12:16 am on Sep 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks DrBrain - that cleared things up for me very well, and it validated what I had gleaned so far.