Skip to main content

Oregon State Flag An official website of the State of Oregon »

Oregon.gov Homepage

Identifying Language of a Document and its Parts

Overview

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:

<html lang="en">

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).

<p lang="es">
<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>
</p>

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:

  1. From File Menu, select Properties.
  2. In the “Document Properties” dialog, click the Advanced tab.
  3. Near the bottom of the dialog, select the document language using the Language combo box.

Screen shot of Document Properties dialog, Advanced tab, Language field set to English 

Follow these steps to define the language of particular parts within a PDF file using Adobe Acrobat Pro :

  1. Open the Tags pane by going to View > Show/Hide > Navigation Panes > Tags.
  2. Select the foreign language text in the document.
  3. In the tags pane, click on the Tags menu and select “Find Tag from Selection”.
  4. The tag for the selected text will be highlighted in the Tag pane. Right click it, and select Properties.
  5. In the Object Properties dialog, select the “Tags” tab, and select the language of the text from the Language combo box.

Screen shot of Object Properties dialog, used to change language to French for a selected paragraph that's in French 

External WCAG References

Most Details from this page were gleaned from the University of Washington's Accessible Technology section.