The HTTP Accept-Language request header is included in an HTTP message to indicate the languages that the client can understand.
The HTTP Accept-Language request header is part of the Content Negotiation process and specifies which natural language the client prefers, as well as the region. It is important to consider that the server is not always able to determine the language of a resource in question, and the client request can only be used as a hint. Similarly, there are myriad situations where the choice of language is outside of the client’s control, such as when they are connecting from a foreign country.
When the server responds, it will include the Content-Language HTTP response header to indicate which choice was made. Generally, if the server cannot honor the client’s request, the HTTP header is ignored. The alternative is to respond with a 406 Not Acceptable HTTP status code, although this will likely result in a worse user experience.
In this example, the client requests that the server send resources in British English. As a second choice, the client prefers non-regional English, followed by German. The server responds, indicating that the content is in generic English.
GET / HTTP/1.1
Accept-Language: en-UK, en, de;q=0.5
HTTP/1.1 200 OK
The Accept-Language request header is used by clients to inform the server which language and region they prefer. If available, the server will respond, also indicating as best as it can the language of the audience the resource is intended for.