I want to determine more than one language for a document, because it's available in more than one language. If I use:
<meta http-equiv="content-language" content="en,de,fr" />
this is not W3C valid and the validator says I should define it in the root's lang
attribute, but this attribute only supports one language:
<html lang="en">
works, but not
<html lang="de,en,fr">
So where should I define it?
If your intended audience speaks more than one language, the HTTP header allows you to use a comma-separated list of languages. 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 lang (or sometimes the xml:lang ) attribute specifies the natural language of the content of a web page. An attribute on the html tag sets the language for all the text on the page.
The lang attribute in HTML allows you to set content for languages other than English. You can try to run the following code to implement lang attribute.
HTML lang Attribute The lang attribute specifies the language of the element's content. Common examples are "en" for English, "es" for Spanish, "fr" for French, and so on.
All attributes support only one language, so I believe you should define only one language; the most important language should be set. This can't be done if you have multiple languages on a single document, so here is the info to solve your problem:
The lang and xml:lang attributes do not allow you to assign multiple languages to a single document. So if you're writing a Web page with multiple languages you have two options:
lang
attribute, and then call out the secondary language(s) with lang
attributes on elements in the documentDefine lang
in the specific sections of the document as needed:
<div lang="fr-CA" xml:lang="fr-CA"> Canadian French content... </div> <div lang="en-CA" xml:lang="en-CA"> Canadian English content... </div> <div lang="nl-NL" xml:lang="nl-NL"> Netherlands, Dutch content... </div>
I have some multiple-language pages and I do use the 2nd option.
You might want to read http://www.w3.org/TR/2007/NOTE-i18n-html-tech-lang-20070412/#ri20060630.133619987
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With