Specify the language of a text written in another language
If a sentence or paragraph in the content is written in a language other than the default language, this must be indicated in the code. This way software can determine the language of the web page. This obligation only applies to sentences and paragraphs, not to individual words.
Reading software reads a web page. The pronunciation of the words depends on the language of the page. If no language or a wrong one is specified in the code, reading software may read the content incorrectly or unclearly. The default language of the browser is then used and it does not always match the language of the content.
Add the lang
attribute to the elements with a different language. Give this attribute a value that consists of a two-letter code that represents a language. The lang
attribute can be used at the block level (<div>
, <p>
, <table>
, etc.) but also on inline elements (<span>
, <a>
, <strong>
, etc.).
It looks like this in the code:
There are exceptions for proper nouns, technical terms, words of an indefinite language, and words or phrases that have become part of the vernacular of the surrounding text.
View all language codes on IANA Language Subtag Registry.
Note: Not all kids of CMS support this feature.