Deutsch
hreflang & language tags

Content-Language header

Also known as: Content-Language HTTP header

The Content-Language header is an HTTP header that states which language group a response is intended for. It describes the intended audience, which is not necessarily the language the text is written in.

How is the header used?

The value is one or more language tags in BCP 47 format, for example de, en-CA or de-DE, en-CA. RFC 3282 defines the syntax, with several languages separated by commas. According to MDN, content without the header is meant for all language audiences.

The lang attribute in HTML serves another purpose. It marks the language of the text and helps browsers with hyphenation and spell checking. The W3C recommends always setting it on the html element. The older <meta http-equiv="content-language"> should no longer be used.

For Google Search the header has no documented role. Google says it detects a page’s language with algorithms based on visible content and does not use hreflang or the lang attribute for that. Content-Language is not mentioned in its hreflang documentation. Language and country versions are reported with hreflang.

Example

HTTP
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Content-Language: de-DE

Sources

  1. Content-Language – MDN Web Docsdeveloper.mozilla.org
  2. RFC 3282: Content Language Headers – IETFrfc-editor.org
  3. Declaring language in HTML and HTTP – W3C Internationalizationw3.org
  4. Tell Google about localized versions of your page – Google Search Centraldevelopers.google.com

Last updated: