Web checklist

Checkpoint 3.1a: Language of page

The default human language of each Web page can be programmatically determined.


Rationale

The identification of a Web page's primary language enables assistive technology to correctly read the content. The lang attribute of the <html> element allows you to specify the language.

Required development and unit test techniques


To comply with this checkpoint, you must meet the following technique.

This technique is defined in WCAG 2.0 Level A Success Criterion 3.1.1 (link resides outside of ibm.com).

  1. Primary natural language: Identify primary natural language(s) using the lang attribute of the <html> element.

Note: The examples presented in the techniques are not exhaustive. They are meant to illustrate the spirit of this checkpoint.

HTML examples

1. Primary natural language: Identifying primary natural language(s) using the lang attribute of the html element.

HTML example 1

Using the lang attribute to identify the language of the page helps ensure that assistive technologies like Braille software and screen readers will correctly pronounce the text. In the example below, the lang attribute is used to indicate that the page is in English. If the page is authored in a left-to-right language, only the lang attribute is required. For XHTML, use the xml:lang attribute.

<html lang="en" xml:lang="en">

HTML example 2

When multiple html elements are present, use the lang attribute on each one to identifying the primary natural language. The following example, shows two iframes embedded in a Web page. Each iframe contains an html element with a lang attribute that identifies the primary natural language.

<html lang="en">
    ...
    <body>
        <iframe ...>
            <html lang="en">
            ...
            </html>
        </iframe ...>
        <iframe ...>
            <html lang="en">
            ...
            </html>
        </iframe ...>
    </body>
</html>

For additional information, refer to the WCAG 2.0 examples of using the lang attribute on the html element (link resides outside of ibm.com).

Required unit tests for HTML development technique 1

There are no manual test techniques for this example.


IBM® Lotus® Domino® examples

For techniques where there are no specific examples for your technology, use the HTML examples for guidance.

  1. Primary natural language: Identify primary natural language(s) using the lang attribute of the <html> element.

    To comply with this technique, you must implement the following example.

    You can use the lang attribute to specify the language on the page using Domino 7.02 or later.

    Domino example 1

    On the form, create a new field with the following properties:

    • In the Name field, enter $$HTMLTagAttributes.
    • In the Type field, select Text and Computed for display.
    • Go to the Hide tab. Under Hide Paragraph from, check Notes and Web browsers.
    • In the Value pane, enter {lang="en"} .

    When you display the form in Domino, look at the source. The lang attribute is now added to the <html> element.

    Required unit tests for Domino development technique 1

    There are no manual test techniques for this example.


Recommended development techniques

Although you do not have to implement the recommended techniques in order to comply with this checkpoint, you should review them since they can improve the accessibility and usability of the application.

  1. Use the dir attribute: Identifying the primary text direction using the dir attribute of the <html> element.

Recommended development example 1

The following example illustrates the use of both the lang attribute and the dir attribute when a Web page is authored in a right-to-left language, such as Hebrew or Arabic.

<html lang="he" xml:lang="he" dir="rtl" >

Refer to the WCAG 2.0 Additional Techniques (Advisory) for Success Criterion 3.1.1 (link resides outside of ibm.com) for more techniques and examples.


Copyright 2012, 2013  IBM Corporation

Last updated August 1, 2012.

W3C Recommendation 11 December 2008: http://www.w3.org/TR/WCAG20/ (link resides outside of ibm.com)
Consortium for Informatics and Mathematics, Keio University), All Rights Reserved.