If you use a different language within the body of your page such as Spanish, French, Italian, German, Chinese, etc. then the language attribute (
lang) would need to be used for that text. This will ensure the screen reader pronounces the word or phrase correctly with the proper accent.
Add the lang attribute to an entire paragraph in Spanish:
<p lang=“es”>La bicicleta es roja.</p>
Add the lang attribute to an image with Spanish alt text:
<img src=“image.jpg” alt=“una bicicleta roja” lang=“es” />
Add the lang attribute to text in the middle of a paragraph:
<p>The title is <span lang=“fr”>Le Bon Usage</span>.</p>