Mark phrases and passages written in another language so assistive technology can switch pronunciation. Notices and language choosers.
A page can be mostly English and still contain a Spanish notice, a Vietnamese greeting or a quoted legal phrase. Assistive technology that reads the whole page in English will garble those parts. WCAG 2.1 success criterion 3.1.2 (Level AA) asks that the human language of each passage or phrase can be programmatically determined, which in HTML means a lang attribute on the element that wraps the foreign text.
The criterion carves out four exceptions:
So you mark passages and phrases that are clearly in another language, not every borrowed word. If you are unsure whether a term has been absorbed, ask whether an English-speaking reader would pronounce it as English.
Language-access notices are a staple of government pages: a "Se habla español" line on a clinic page, interpreter-availability banners, translated emergency notices, and a language chooser in the header. The chooser is a frequent weak spot, because the language names are written in their own language but not marked up. A person who relies on a screen reader and needs those services is the one least able to skip over garbled speech. For site-wide patterns, see common barriers.
<p>Interpreters are available. Se habla español.</p><p>Interpreters are available. <span lang="es">Se habla español.</span></p><nav aria-label="Language">
<a href="/es/">Español</a>
<a href="/vi/">Tiếng Việt</a>
<a href="/zh/">中文</a>
</nav><nav aria-label="Language">
<a href="/es/" lang="es" hreflang="es">Español</a>
<a href="/vi/" lang="vi" hreflang="vi">Tiếng Việt</a>
<a href="/zh/" lang="zh-Hans" hreflang="zh-Hans">中文</a>
</nav><blockquote>
Chào mừng đến thư viện. Chúng tôi mở cửa từ 9 giờ sáng.
</blockquote><blockquote lang="vi">
Chào mừng đến thư viện. Chúng tôi mở cửa từ 9 giờ sáng.
</blockquote><p>مرحباً بكم في التسجيل المدرسي</p><p lang="ar" dir="rtl">مرحباً بكم في التسجيل المدرسي</p>Native platforms attach language to spans of text through their own accessibility APIs; those are not covered by the web examples above. As a design rule, keep foreign-language passages in short, separate text elements so they can be tagged individually.
lang attribute with the right code.lang and flag invalid codes. No tool reliably detects unmarked foreign text, so human reading is the main check.lang when only one phrase is foreign.lang="spanish" or lang="sp". The code for Spanish is es.lang.dir="rtl".