LOC-6Required
Mark foreign words
Mark every passage in another language with its own lang attribute.
How to do it
Wrap foreign phrases in <span lang="…">, using valid language codes. This is WCAG 2.2 success criterion 3.1.2, Language of Parts. In email, follow Declare the language and text direction.
Examples
HTML example
<p>The French call it <span lang="fr">mise en place</span>: everything in its place.</p>
How to check
An accessibility checker such as axe reports no valid-lang failures. A test keeps a list of the foreign phrases the site uses, and finds each one inside an element with a matching lang.
Sources
Related rules
- EML-5 Declare the language and text direction in Email
- LOC-7 Keep names out of machine translation in Localization
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/localization/multilingual-websites/lang-attribute">Agent Wranglers localization playbook</a>. In code you write, add a comment next to it with the same link.