3.1.2 Language of Parts

The human language of each passage or phrase in the content can be programmatically determined except for proper names, technical terms, words of indeterminate language, and words or phrases that have become part of the vernacular of the immediately surrounding text. (Level AA)


Before understanding language of parts, consider reading 3.1.1 language of page for better understanding of the concept.

Any web page is written in human readable language and hence a language attribute will be specified allowing the user agents, assistive technologies, search engines, braille displays to interpret the content accurately. When a web page is written in multiple languages or a specific phrase or passage is specified in non-primary language user agents and assistive technologies should be able to identify that language and interpret accurately.

Specifying the language of a phrase or passage that is written in different language than the default one helps screen readers to use pronunciation rules of the language, helps the graphical browsers to display the characters and scripts in a proper way. When the language of the phrase or passage is not specified then the default human language will be considered by the user agents and assistive technologies. In certain cases screen readers will try to identify the language in the best possible way and renders to the screen reader users.

Identifying the change in language is required because

  • It allows braille translation software to follow changes in language, e.g., substitute control codes for accented characters, and insert control codes necessary to prevent erroneous creation of Grade 2 braille contractions.
  • Speech synthesizers that support multiple languages will be able to speak the text in the appropriate accent with proper pronunciation. If changes are not marked, the synthesizer will try its best to speak the words in the default language it works in. Thus, the French word for car, “voiture” would be pronounced “voyture” by a speech synthesizer that uses English as its default language.
  • Marking changes in language can benefit future developments in technology, for example users who are unable to translate between languages themselves will be able to use machines to translate unfamiliar languages.
  • Marking changes in language can also assist user agents in providing definitions using a dictionary.

How to declare language for a phrase or passage

In the tag of the phrase or passage use ‘lang’ attribute. In case of XML provide xml: lang attribute for language reference. Use both lang and xml:lang in case of XHTML 1.x or an HTML5 polyglot.

These language attributes should refer to HTML ISO language codes. Eg: The HTML language code for English is ‘en’, German is ‘De’, and French is ‘Fr’. To define sub languages use a hyphen (-) i.e. to differentiate British English use en-gb and for United States English it is en-us.

Sample Code

</p> <p lang=”Fr”>This is content in French</p> <div lang=”De”>This is content in German</div> <p>

Techniques for 3.1.2