You are here:

  1. Manual
  2. Development
  3. Languages
  4. Language variations

Languages: Language variations within a page

Specifying The base language for a page is the first step towards indicating language in the markup. However, the content of the page may include English words, a quote in French or the title of a German book are a few possible examples. The following step is to specify the language of these words and sentences in the markup.

Web developers and content managers should aim for adequately marking of deviations from the base language in the content of pages. Specification of these language deviations in the markup has the same benefits as specifying the base language of a page.

Indicate language variations in the content of pages in the markup.

Guideline R-pd.15.7

Language changes are marked by means of the lang attribute that can be applied to virtually every HTML element. A number of examples are given below.

Example of use of the lang attribute (HTML)


Some cars possess what the Germans call <span lang="de">Uberhol-Prestige</span>.

The lang attribute on a quote (HTML)

<blockquote lang="fr">
<p>
Raconter tout serait impossible.
</p>
</blockquote>

As described for The base language of a page, in XHTML 1.0, the lang attribute is used along with the xml:lang variant: <blockquote lang="fr" xml:lang="fr">.

Due to the application of the lang attribute all text and elements within the element with this attribute will be seen as part of that language.

When adding language markup, first assess whether or not a suitable HTML element be applied to the text. Like the above-mentioned p (paragraph) element and the blockquote element (for block quotes). subsequently, the lang attribute can be added. If no suitable element can be found, inserting a neutral element like the SPAN element may be a solution.

What are language variations?

In principle, words (or parts of compound words) that are not included in the general dictionary for the base language selected are seen as deviations from this language.


Web Guidelines version 1.3, November 2007.