View Full Version : The "lang" attribute

12-26-2002, 05:44 AM
What exactly does the "lang" attribute of HTML elements do? Is it just informational, or has some other purpose?

The following two sentences display the same content. What would one want to give the "lang" attribute for a particular span?

<SPAN id="msg1" class="info" lang="fr">Variable d&eacute;clar&eacute;e deux fois</SPAN>

<SPAN id="msg1" class="info" lang="en">Variable d&eacute;clar&eacute;e deux fois</SPAN>

Well, i found this example while going through the HTML 4.01 specification.

12-26-2002, 05:51 AM

devguru is awesome.

12-26-2002, 07:56 AM

I found this in the HTML 4.01 specification:

Language information specified via the lang attribute may be used by a user
agent to control rendering in a variety of ways. Some situations where
author-supplied language information may be helpful include:
- Assisting search engines
- Assisting speech synthesizers
- Helping a user agent select glyph variants for high quality typography
- Helping a user agent choose a set of quotation marks
- Helping a user agent make decisions about hyphenation [p.96] , ligatures, and spacing
- Assisting spell checkers and grammar checkers