|Language in doctype|
Is it valid
| 10:45 pm on Aug 18, 2004 (gmt 0)|
Is it valid to change the doctype declaration part '//EN' to whatever language your website is written in? My website, which is in Dutch, uses this declaration:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//NL" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
My site now validates at w3c as "Valid -//W3C//DTD XHTML 1.0 Transitional//NL", instead of "Valid XHTML 1.0 Transitional". Does that mean it's less-supported or invalid?
Or should I just ignore the difference and accept this as 'valid xhtml'?
| 1:17 am on Aug 19, 2004 (gmt 0)|
As far as I know, the correct place to indicate language is in the lang attribute of the html element, not the DTD:
Secondarily, language may also be indicated in a meta tag, but the lang attribute is supposed to override a meta tag language declaration, in case of a conflict.
|<meta HTTP-EQUIV="Content-Language" Content="nl"> |
Language information is also sent by the server in the HTTP header.
Here's a W3C Reference [w3.org] about language on a web page. But, I can't find any W3C reference that recommends changing the DTD - so I wouldn't recommend it either.
| 4:08 am on Aug 19, 2004 (gmt 0)|
Don't change the language code in the public identifier.
That abbreviation doesn't refer to the content of the document. It refers to the language used to develop the markup language -- HTML tag names are taken from English, so the language has to be //EN. Always. No exceptions.
| 5:09 am on Aug 19, 2004 (gmt 0)|
Thanks, mbauser2. That was what I thought the EN stood for, but I was a bit gun shy in making a strong statement because I could not find a reference.
Do you have one?
| 9:40 am on Aug 19, 2004 (gmt 0)|
(Not a reference)
| 10:45 am on Aug 19, 2004 (gmt 0)|
Not a official reference either, but a good explanation:
Basically, the "EN" refers to the language of the DTD, not of the document itself. All W3C DTDs are written in English, so you should always use EN. If you have created your own DTD for your SGML documents, then it may be different (but you would be using SGML, not just HTML).
It is best to set the document language in the HTTP header before the page is served, or, failing that, to declare the language on the
html element, either with the
lang attribute (for HTML) or the
xml:lang attribute (for XHTML). You can also specify the language in a meta element if you aren't able to change the
html element (if you're using a CMS with limited access to the markup, for example).