I would like to react to the Accept_Language that a browser sends to a website.
Does anybody know where I can get a reliable list of all available Accept_Languages that the browser might send to a website?
Thank you very much!
The Accept-Language request HTTP header indicates the natural language and locale that the client prefers. The server uses content negotiation to select one of the proposals and informs the client of the choice with the Content-Language response header.
The user can change the Accept-Language header sent by the browser using the browser's preference settings. E.g., in Chrome, go to “Settings”, click on “Show advanced settings...”, scroll down to “Languages”, click on “Language and input settings...”, and then add languages and drag to order them.
To check this Accept-Language in action go to Inspect Element -> Network check the request header for Accept-Language like below, Accept-Language is highlighted you can see. Supported Browsers: The browsers are compatible with HTTP Accept-Language header are listed below: Google Chrome.
The Accept header is used to inform the server by the client that which content type is understandable by the client expressed as MIME-types. By using the Content-negotiation the server selects a proposal of the content type and informs the client of its choice with the Content-type response header.
IANA Language Subtag Registry page
This is the official location where you will find all subtags available for use in language tags.
W3 said it's the authoritative list. Plus, at the link below, there is a lot more information to be had, including descriptions and other ways of understanding the ways people label themselves.
http://www.w3.org/International/techniques/server-setup#multiviews
The IANA Language Subtag Registry page is surely the correct answer, but the list is a bit hard to parse.
I found this github repository that has a few scripts to parse it, and a set of ready-to-use JSON objects you can use in your projects:
https://github.com/mattcg/language-subtag-registry
It looks like the author is updating the repo every time the IANA list gets changed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With