There’s a lot of misinformation about how, when and where to declare a language – or multiple languages – within HTML and XHTML documents. Fortunately, the GEO group at the W3C provides us with details as to how to do this. Here are some guidelines to help:
- Always declare the default text processing language of the page, using the
htmltag, unless there are more than one primary languages.
- Use the
xml:langattributes around text to indicate any changes in language.
- Do not use
Content-Languageto declare the default text processing language, and do not use language attributes to declare the primary language metadata.
- Do not declare the language of a document in the
- For HTML use the lang attribute only, for XHTML 1.0 served as text/html use the
xml:langattributes, and for XHTML served as XML use the
- If the text in attribute values and element content is in different languages, consider using a russian doll approach.
- For documents with multiple primary languages, decide whether you want to declare a single text processing language in the
htmltag, or leave it undefined.
This BUZZ entry is also available in German.
Post a Reply
Comments are closed.