Accept-Language Header
Table of Content
The Accept-Language HTTP header allows client software, such as web browsers, to specify the preferred language for processing the request made by the client. This is part of the uniform HTTP protocol web servers and clients use to communicate. The preference is sent to the server, and the server then responds with the requested resource in the preferred language if available. This allows for localization and personalization, leading to a smoother web user experience.
Syntax
Accept-Language: <language>
Accept-Language: <language>-<region>Directives
The directives for the Accept-Language request HTTP header include:
<language>: This is the standard language abbreviation. For instance, "en" for English, "fr" for French etc.<region>: This is a country or regional specifier. Like, "us" for United States, "ca" for canada etc.
Examples
Here are some examples on how Accept-Language header can be used:
GET / HTTP/1.1
Host: www.example.com
Accept-Language: enGET / HTTP/1.1
Host: www.example.com
Accept-Language: en-usBrowser Compatibility
| Browser | Compatibility |
|---|---|
| Chrome | Supported |
| Firefox | Supported |
| Safari | Supported |
| Opera | Supported |
| Edge | Supported |
How to modify Accept-Language header
ModHeader is a Chrome extension that allows you to modify request headers, including the Accept-Language header, directly from your browser. To do this:
- Install the ModHeader extension from the Chrome Web Store.
- Click on the ModHeader icon in Chrome's extension bar to open the ModHeader control panel.
- In the "Request headers" section, click on "+Add".
- In the "Name" field, enter "Accept-Language". In the "Value" field, enter your preferred language code (e.g., "en-us").
- Press "Enter" to save your changes.
From this point onwards, all HTTP requests sent from your browser will include the modified Accept-Language header, potentially changing the language of the resources returned to you.