Convey Natural Language: different languages inline

If the document uses different languages inline the language attribute is set on the element where the language changes:


  <html lang="en" xml:lang="en" >
   <head>...</head>
   <body>
     [... english content ...]
     [... suddenly a spanish paragraph:]
     <p lang="es">Tengo que acabar esto...</p>
     [... english content continues ...]
   </body>
  </html>

In the case above only the one spanish paragraph is regarded as spanish because lang="en" was set on the parent - the lang="es" attribute temporarily overrides what is otherwise true for all children of the parent.

In other words, an element will inherit the language specified for its parent, unless otherwise is specified on the child itself.

Language codes are available in Language Code Listing.