I want to determine more than one language for a document, because it\'s available in more than one language. If I use:
As the other posters and the W3C have pointed out, you cannot specify more than one language in the lang
attribute of the html
tag.
However, as shown in this answer to "What attribute value should I use for a mixed language page?", you can markup different parts of a page with elements such as div
and span
tags to indicate different languages (or references to other languages) used on the page.
Also, you can create metadata that describes multiple languages for the intended audience of a page, rather than the language of a specific range of text. You do so by getting the server to send the information in the HTTP Content-Language
header. If your intended audience speaks more than one language, the HTTP header allows you to use a comma-separated list of languages.
Here is an example of an HTTP header that declares the resource to be a mixture of English, Hindi and Punjabi from the W3C's article Declaring language in HTML:
Content-Language: en, hi, pa
Please Note: since you should always use a language attribute on the html
tag, and the language attribute always overrides the HTTP header information, this really becomes a fine point. The HTTP header should be used only to provide metadata about the intended audience of the document as a whole, and the language attribute on the html
tag should be used to declare the default language of the content.
For details on this last technique, see HTTP headers, meta elements and language information. For general language declarations and markup, see Declaring language in HTML.