• April 13, 2024

Accept Language Values List

Accept-Language – HTTP – MDN Web Docs

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. Browsers set required values for this header according to their active user interface language. Users rarely change it, and such changes are not recommended because they may lead to fingerprinting.
This header serves as a hint when the server cannot determine the target content langauge otherwise (for example, use a specific URL that depends on an explicit user decision). The server should never override an explicit user language choice. The content of Accept-Language is often out of a user’s control (when traveling, for instance). A user may also want to visit a page in a language different from the user interface language.
The server possibly can send back a 406 (Not Acceptable) error code when unable to serve content in a matching language. However, such a behavior is rarely implemented for a better user experience, and servers often ignore the Accept-Language header in such cases.
Header type
Request header
Forbidden header name
no
CORS-safelisted request header
yes, with the additional restriction that values can only be
0-9, A-Z, a-z, space or
*, -. ;=.
SyntaxAccept-Language:
Accept-Language: *
// Multiple types, weighted with the quality value syntax:
Accept-Language: fr-CH, fr;q=0. 9, en;q=0. 8, de;q=0. 7, *;q=0. 5
Directives

A language tag (which is sometimes referred to as a “locale identifier”). This
consists of a 2-3 letter base language tag that indicates a language, optionally
followed by additional subtags separated by ‘-‘. The most common extra
information is the country or region variant (like ‘en-US’ or
‘fr-CA’) or the type of alphabet to use (like ‘sr-Latn’).
Other variants, like the type of orthography (‘de-DE-1996’), are usually
not used in the context of this header.
*
Any language; ‘*’ is used as a wildcard. ;q= (q-factor weighting)
Any value placed in an order of preference expressed using a relative
quality value called weight.
ExamplesAccept-Language: de
Accept-Language: de-CH
Accept-Language: en-US, en;q=0. 5
SpecificationsSpecificationHypertext Transfer Protocol (HTTP/1. 1): Semantics and Content (HTTP/1. 1)# compatibilityBCD tables only load in the browserSee also
HTTP content negotiation
A header with the result of the content negotiation:
Content-Language
Other similar headers: TE, Accept-Encoding, Accept
Accept Language list - Stack Overflow

Accept Language list – Stack Overflow

answered Dec 16 ’12 at 8:10
Jared FarrishJared Farrish46. 4k16 gold badges90 silver badges100 bronze badges
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:
It looks like the author is updating the repo every time the IANA list gets changed.
answered Nov 30 ’14 at 14:57
Not the answer you’re looking for? Browse other questions tagged content-negotiation -accept-language or ask your own question.
Accept-Language - HTTP - MDN Web Docs

Accept-Language – HTTP – MDN Web Docs

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. Browsers set required values for this header according to their active user interface language. Users rarely change it, and such changes are not recommended because they may lead to fingerprinting.
This header serves as a hint when the server cannot determine the target content langauge otherwise (for example, use a specific URL that depends on an explicit user decision). The server should never override an explicit user language choice. The content of Accept-Language is often out of a user’s control (when traveling, for instance). A user may also want to visit a page in a language different from the user interface language.
The server possibly can send back a 406 (Not Acceptable) error code when unable to serve content in a matching language. However, such a behavior is rarely implemented for a better user experience, and servers often ignore the Accept-Language header in such cases.
Header type
Request header
Forbidden header name
no
CORS-safelisted request header
yes, with the additional restriction that values can only be
0-9, A-Z, a-z, space or
*, -. ;=.
SyntaxAccept-Language:
Accept-Language: *
// Multiple types, weighted with the quality value syntax:
Accept-Language: fr-CH, fr;q=0. 9, en;q=0. 8, de;q=0. 7, *;q=0. 5
Directives

A language tag (which is sometimes referred to as a “locale identifier”). This
consists of a 2-3 letter base language tag that indicates a language, optionally
followed by additional subtags separated by ‘-‘. The most common extra
information is the country or region variant (like ‘en-US’ or
‘fr-CA’) or the type of alphabet to use (like ‘sr-Latn’).
Other variants, like the type of orthography (‘de-DE-1996’), are usually
not used in the context of this header.
*
Any language; ‘*’ is used as a wildcard. ;q= (q-factor weighting)
Any value placed in an order of preference expressed using a relative
quality value called weight.
ExamplesAccept-Language: de
Accept-Language: de-CH
Accept-Language: en-US, en;q=0. 5
SpecificationsSpecificationHypertext Transfer Protocol (HTTP/1. 1): Semantics and Content (HTTP/1. 1)# compatibilityBCD tables only load in the browserSee also
HTTP content negotiation
A header with the result of the content negotiation:
Content-Language
Other similar headers: TE, Accept-Encoding, Accept

Frequently Asked Questions about accept language values list

What is accept-language?

The Accept-Language request HTTP header indicates the natural language and locale that the client prefers. This header serves as a hint when the server cannot determine the target content language otherwise (for example, use a specific URL that depends on an explicit user decision). …Oct 21, 2021

Where does accept-language come from?

The Accept-Language header is information about the user’s language preferences that is passed via HTTP when a document is requested. Mainstream browsers allow these language preferences to be modified by the user. The value itself is a defined by BCP 47, typically as a two or three letter language code (eg.

Do all browsers send accept-language?

By default, the user’s browser will send the accept-language header based on the language settings for the browser which, like someone pointed out below, average users have no clue what those are, where those are, or how to change them.Aug 30, 2013

Leave a Reply

Your email address will not be published. Required fields are marked *