Content-Language Header
Table of Content
The Content-Language header indicates the natural language(s) of the intended audience for the document. This allows users to specify languages in preference order for HTTP request messages. For HTTP responses, if no Content-Language is specified, the default is that the content is intended for all language audiences. This can be overridden by user agent settings.
Syntax
The syntax structure for the header can be displayed in the following format:
Content-Language: language
Your language directive will replace the “language” mentioned in the syntax.
Directives
The directives for the Content-Language header could consist of a single language tag or multiple language tags.
The language tags should conform to BCP 47. They can include primary language tags, subtags and region tags as necessary.
For example, "en" stands for English, while "en-US" stands for English as used in the United States.
Examples
Here are some examples of usage of the Content-Language header:
Single Language
Content-Language: fr
This indicates that the server intends to return a response document in French.
Multiple Languages
Content-Language: en, fr
This example indicates that the intended audience for the document is capable of understanding English and French at the same time.
Browser Compatibility
Browser | Compatibility |
---|---|
Chrome | Supported |
Firefox | Supported |
Safari | Supported |
Opera | Supported |
Edge | Supported |
How to modify Content-Language header
ModHeader is a Chrome extension that allows you to modify headers on-the-fly to test servers, pages, and verificarion of HTTP headers and response data. To configure the Content-Language header with ModHeader, follow these steps:
- Install the ModHeader browser extension.
- Click on the ModHeader icon in the toolbar.
- In the dropdown, click on ‘Add'.
- Enter 'Content-Language' in the ‘Response header’ field.
- Enter the language tag (e.g., 'en') in the 'Value' field.
- Save the settings.
With this setup, ModHeader replaces the Content-Language header in your request with the value you specified, enabling you to test the behavior of the server or page with different language settings.