According to the WCAG 2.1 Guideline 3.1.1 Language of Page (Level A), “The default human language of each Web page can be programmatically determined.”
The LANG attribute is designed to alert screen readers on the appropriate language to use when announcing page content.
To assign a primary language to an HTML page, add the lang attribute to the <html> tag. Here’s how you would add the language attribute for US English:
But what if you use more than one language on your Web page?
Here are some tips that can help.
1) DEFAULT LANGUAGE: When a Web page uses several languages, the default text-processing language is the language which is used most. If several languages are used equally, the first language used should be chosen as the default human language. [SOURCE]
2) ALT TEXT: Alt attribute values should contain text in the primary language of the page. If the main language of the page is French, then the alternative text for images needs to be in French. [SOURCE]
3) LANGUAGE CHANGE ON THE PAGE: According to the WCAG 2.1 – 3.1.2 – Language of Parts (Level AA) Guideline, screen readers need to be notified when the language on a page changes. To do so, add a language attribute to the tag that surrounds the content that is not in the primary language.
US English: “The Grapes of Wrath”
French Translation: <p lang=”fra”>”Les raisins de la colère”</p>
German Translation: <div lang=”de”>”Früchte des Zorns”</div>
RESOURCE: Table of Language Codes
WEBSITE ACCESSIBILITY TESTING & REMEDIATION SERVICES: Mary Gillen is an experienced Website Accessibility Compliance Auditor and Remediator. She can test your website to determine if it meets accessibility standards:
WCAG 2.1: 312 checkpoints covering A, AA and AAA W3 accessibility guidelines
Section 508: 15 US federal guidelines covered by 59 accessibility checkpoints
Find out more about Mary Gillen’s Accessibility Testing & Remediation Services: Websites, PDFs, Office Docs & Videos