Accessibility Recipes/Language

From DPWiki
Jump to navigation Jump to search

Identifying the main language of your book is very easy to do. With a bit more work, it's also good to mark up any changes in language.

What to do and how?

All languages have code, of two or more letters. Common examples are English en, French fr and German de, and also Latin la and Greek el. A full list can be found at the Library of Congress. Note that the language code is often but not always the same as the country code.

To identify the main language of your book, just add the lang attribute to your <html> tag. If you are using XHTML, use both lang and xml:lang, as advised in the W3C compatibility document. Like this:

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

When a passage or phrase is in a different language, that can be marked by putting the attributes onto any tag enclosing the text, such as a <blockquote> or a <span>. Here are some examples:

It adds a certain <i lang="fr" xml:lang="fr">je ne sais quoi</i>.

His 1888 work <cite lang="la" xml:lang="la">Ecce Homo<cite>, <cite lang="de" xml:lang="de">Wie man wird, was man ist</cite> deals with....

John's central theme is <span lang="el" xml:lang="el">&#8001; &lambda;&omicron;&gamma;&omicron;&sigmaf;</span>, the Word.

Finding all instances can be a bit of a nuisance. If you're very lucky, they might all be italicised so you can find them easily. If not, searching for special characters should catch some of them; bibliographies often contain lots; but other than that it's really a smoothreading job. It can be helpful to give the ones already marked a background colour (temporarily!) so that any missed ones are noticeable.

* > *[lang] { background-color:wheat; }

(The colour name "wheat" isn't valid in XHTML: this is intentional, so there's no danger of accidentally uploading the project with the colour still in!)

Why?

W3C:

  • WCAG 1 Checkpoints 4.1 and 4.3 Clearly identify changes in the natural language of a document's text and any text equivalents (e.g., captions). (Priority 1); Identify the primary natural language of a document. (Priority 3).
  • Draft WCAG 2 Success criteria 3.1 and 3.2 Language of Page: The default human language of each Web page within the content can be programmatically determined. (Level A); Language of Parts: The human language of each passage or phrase in the content can be programmatically determined. Note: This requirement does not apply to individual words. It also does not apply to proper names, to technical terms or to phrases that have become part of the language of the context in which they are used. (Level AA).

Marking individual words is listed as Advisory although not required for AA compliance.

Who benefits?

Screenreader users (i.e. people who are blind or have poor sight, are dyslexic, or perhaps poor at reading the language, or simply like having the book read to them). This is because if the language isn't marked, the screenreader will pronounce everything as if it were the default language, usually English. This can sound dreadful! The above examples in FireVox sound like

It adds a certain jee knee say's quoy.

His 1888 work Ess Hoe-mow, Wee man word, woz man ist deals with....

John's main theme is ... the word.

(So FireVox can't cope with Greek, marked or not, apparently.)

Marking the languages also helps with conversion to Braille. Search engines use language information too, as do automatic language translators.

Drawbacks

None, other than the effort involved. Unfortunately you might not see much of a return for your efforts, unless you have installed not only a screenreader but voices for the various languages. If you don't have the right voice, English will just get used anyway.

Testing

  • Install a screenreader. Even if you don't want to install all the stuff necessary to take advantage of the language markup, it will convince you how awful it sounds with the wrong pronunciation.

Further Reading

  • Language Tags from W3C gives more detail on how the code can specify not just language but region and script etc.
  • Language by the RNIB.