Many screen reader applications support multiple languages, and can switch on-the-fly between supported languages, using the appropriate voice and rule set for the current language. However, currently screen readers are unable to determine what language a document is written in, or if the language changes within that document. Therefore it is important for authors to define the language of the document or web page, and to identify the language of any blocks of text that deviate from that default language.
Identifying the language of the entire web page or document, as well as its individual parts, helps to ensure that screen readers will correctly pronounce the content.
Defining Language in HTML
In a Page
In HTML the language of content is identified using the lang attribute, the value of which is a standard BCP 47 Language Code. For example the following tag identifies the entire HTML document as being an English:
In Part of a Page
In Content on Current Page
If a paragraph, table cell, list item, or any other block of text changes from the default language of the page, that too must be marked up with a LANG attribute. For example, imagine that our English document contains a short paragraph in French, as in the following example:
<p lang="fr">Vaut mieux prévenir que guérir.</p>
In a Link
If your link is directing the user to a page or document that is displayed in a different language, that link should contain an HREFLANG attribute.
<a href="reportcards/pdf/Nuevo-Dise%c3%b1o-de-los-Perfiles-de-los-Distritos-y-Escuelas.pdf" hreflang="es">Spanish Report Card PDF</a>
In Both Content on Current Page and an External Link
If you are re-directing the user to a page or document that is in a different language, the link should contain an HREFLANG attribute (like the A tag of the following example). If that link is written in a different language, it should be wrapped in a LANG attribute (like in the P tag of the following example).
<a href="reportcards/pdf/Nuevo-Dise%c3%b1o-de-los-Perfiles-de-los-Distritos-y-Escuelas.pdf" hreflang="es">Nuevo Diseño de los Perfiles de los Distritos y Escuelas</a>
Defining Language in Adobe PDF
The following steps apply specifically to Adobe Acrobat Pro XI. The idea is the same in other recent versions of Acrobat Pro as well, but specific steps may vary slightly.
Follow these steps to define the document language of a PDF in Adobe Acrobat Pro:
- From File Menu, select Properties.
- In the “Document Properties” dialog, click the Advanced tab.
- Near the bottom of the dialog, select the document language using the Language combo box.
Follow these steps to define the language of particular parts within a PDF file using Adobe Acrobat Pro :
- Open the Tags pane by going to View > Show/Hide > Navigation Panes > Tags.
- Select the foreign language text in the document.
- In the tags pane, click on the Tags menu and select “Find Tag from Selection”.
- The tag for the selected text will be highlighted in the Tag pane. Right click it, and select Properties.
- In the Object Properties dialog, select the “Tags” tab, and select the language of the text from the Language combo box.
External WCAG References
Most Details from this page were gleaned from the University of Washington's Accessible Technology section.