Forum Moderators: open

Message Too Old, No Replies

Specify which language used

xml:lang= in DocType

         

Drumat5280

4:20 am on Apr 9, 2006 (gmt 0)

10+ Year Member



I have a site that I am doing in many languages.

For the DocType:


<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">

Would the above be the correct way to specify Spanish correctly?

choster

1:39 pm on Apr 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just to be clear on terminology, the DOCTYPE specifies what markup language you are using, e.g.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

or

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">

and so on, not the human language of the content. The snippet of code which you provided is not part of the DOCTYPE.

In XHTML, you can specify content language in four places. Your example uses one of them, correctly: a lang attribute on the <html> element (and since you are presumably serving the document as MIME type text/html instead of application/xhtml+xml, the additional namespace declaration and xml:lang attribute are also correct). For the other ways or a more thorough explanation, see [w3.org...] .