Its0601TechLangAuth

From W3C Wiki


ITS WG Collaborative editing page

Specify the language of the content

Having information about what is the language of a content is very important in many situation. Some of them are:

  • selection of a proper font (e.g. for traditional or simplified Chinese)
  • processing of the text for wrapping and hyphenation
  • spell-checking the text
  • selecting proper formatting properties for data such as date, numbers, etc.
  • selecting proper automated text such as quotation marks or other punctuation signs

Technique: Use xml:lang to specify in what language is your content

Use the xml:lang attribute to specify in what language is the content of your document.

The normal way of specifying the language of a document is to declare it in the root element and, if needed, to override that initial declaration for parts of the document in a different language.


In this example, the main content of the document in in English,
while a short citation is identified as being in French Canadian.

<document xml:lang="en">
 <para>The motto of Québec is the short phrase:
<q xml:lang="fr-ca">Je me souviens</q>. It is chiseled
on the front of the Parliament Building.</para>
</document>