3.1.2 Language of Parts
This check states that webpages with sections of text in different languages must have an associated lang
attribute for each language. Examples include:
A webpage in English with a passage in French
One lang
attribute must indicate that the language for webpage is English and another lang
attribute must indicate the section in French.
lang
attribute. The lang
attribute of the local language must correctly identify the language of the content it applies to. This ensures that assistive technologies, such as screen readers, can correctly interpret and pronounce the text.
The check verifies that:
lang
attribute is present and correctly set for sections of content in different languages.For example, if a section of a webpage contains the French text, it must have lang="fr"
applied.
This section provides information about why this check is important. In addition, it includes some pass and fail examples.
An incorrect lang
attribute can negatively impact:
lang
attribute to apply the correct pronunciation and reading rules. lang
attribute to apply appropriate spellcheck and grammar rules.This section provides some pass and fail examples.
The correct language for the entire page is specified
<html lang="en">
<head>
<title>Welcome</title>
</head>
<body>
<p>Hello, how are you?</p>
</body>
</html>
lang="en"
attribute matches the language of the page.A section in a different language is correctly specified
<p lang="fr">Bonjour, comment ça va ?</p>
lang="fr"
attribute matches the French text.The wrong language is declared for the content
<p lang="de">Hola, ¿cómo estás?</p>
lang="de"
, which is German.Fix:
<p lang="es">Hola, ¿cómo estás?</p>
lang="es"
is applied.A missing language attribute for multilingual content
<p>Welcome! <span>Bienvenido!</span></p>
lang
attribute to indicate the Spanish text is missing.Fix:
<p>Welcome! <span lang="es">Bienvenido!</span></p>
This section provides instructions on how to review and fix this issue.
lang
attribute is applied to sections where the language changes. lang
value matches the actual language of the text.Ensure that the primary language of the page is correctly declared in the <html>
tag.
<html lang="en">
Use lang
attributes for content in different languages
<span lang="fr">Bonjour</span>
Test the page with a screen reader to verify the pronunciation.
For information about language tags and how to find out the correct tag, visit the following article:
If this content did not answer your questions, try searching or contacting our support team for further assistance.
Thu Apr 03 2025 08:04:51 GMT+0000 (Coordinated Universal Time)