When creating digital content, a central question is in which language it should be published. If no conscious decision is made here, many content management systems (CMS) will label the content as English-language.
What is invisible to the naked eye can leave screen reader users perplexed by incomprehensible content. If not deactivated by the user, the speech output and the Braille output table are based on the language markup. Thus, a German text may be read aloud with English speech output or displayed with the wrong character encoding on the Braille display.
The head of the HTML file contains <html lang="de">, where the "de" in this example stands for a German language markup. This sets the language markup for the entire document. This should therefore be identical to the main language of the page.
However, a text can also contain paragraphs in other languages. If I want to insert an English paragraph into a German text, I start a new paragraph <p> and give it the language tag <p lang="en">. Thus the text is marked up to the closing tag </p> English-language.
Individual words can also be marked up with the help of a span element. The procedure is identical to that for the language marking of a paragraph: <span lang="fr">However, individual words should only be marked separately in exceptional cases, since frequent use causes problems in the reading flow. This is due to the fact that most people have developed a much faster auditory comprehension with their native language and a change of language leads to the fact that not only the pronunciation changes, but in many cases also the voice and sometimes even the gender of the reading voice.
What is the distinction of individual words based on?
The correct pronunciation of common words in other languages is the responsibility of the screen reader manufacturer or text-to-speech engine provider. For example, the word "restaurant" or the word "rendezvous" is already present in the pronunciation rules without a correspondingly set speech markup.
However, since it is impossible to know which screen reader and which speech output will be used when creating the text, it is advisable to exclude foreign language terms as far as possible. If this is not possible, because it concerns product names or names which are rather unusual, a distinction is advantageous. But the rule here is: less is more!
The following two screencasts show the effects of speech markup in HTML.