Rationale
Synthesised speech software is becoming more and more sophisticated with every new browser and screen reader version released. It is now possible to purchase different language modules to make it possible for speech browsers and screen readers to handle a growing range of languages.
For speech software to handle languages correctly, however, the language used in the pages needs to be identified. It is particularly important that any changes in the language being used are coded correctly to enable the speech synthesis software to pronounce the word(s) correctly, or to spell them out if the language is not one for which the user has installed the required software module.
Techniques
-
The main language, also referred to as the natural language, of the page should be indicated above the HEAD of the page source code. For example an English page should be marked up with Lang="en" in the meta data, as shown below:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html40/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-
Ensure your page is encoded using the correct language code. Currently we use ISO 639.2, the two letter codes. Three letter codes, "eng" for example, are valid but the W3C recommend two letter tags as they are backward compatible. The language codes can also consist of two bits ie eng-us. These additional codes define variations in that particular language and are acceptable.
-
Language changes, including single words, quotes or paragraphs of text written in a foreign language, must be indicated using the LANG tag.
-
Images of text displaying languages are not generally encouraged especially for languages that are easy to code such as languages using Roman text. Languages using different scripts such as Cantonese, Punjabi and Arabic can be problematic however so in some cases images can be acceptable for small amounts of text.
Testing tips
Verify that changes in language on a page are flagged up by using the LANG attribute.
-
Accessibility toolbar - Doc Info - Show Lang attributes.
-
Browser - View - Source. Edit - Find "lang" or the text that is a different language.
Further information
Compliance with WCAG 1.0
-
4.1 Clearly identify changes in the natural language of a document's text and any text equivalents (e.g. captions). Priority 1
-
4.3 Identify the primary natural language of a document. Priority 3
-
11.3 Provide information so that users may receive documents according to their preferences (eg language, content type, etc.) Priority 3
For more information on techniques visit the Web Accessibility Initiative techniques page.