Language in Pilot

To indicate a text’s language using Pilot’s HTML editor, you’ll have to go into source view and edit the HTML.

Why Language is Important

Screen readers use a document’s language to determine how to pronounce words. So defining a document’s language can help keep a screen reader from trying to pronounce Spanish as if it were French. In HTML, you can set a default language for the whole document. You can also set a different language for passages within that document.

Document Language

If you click the blue “New” button in a Pilot content module and choose “Create a File,” Pilot will make a new HTML document, save it to your Manage Files area, and create a link to your new document in the module. Unfortunately, that new file won’t have anything that tells a screen reader what language it’s reading. That’s technically flawed. But frankly, most of the time a screen reader will read your text OK anyway, especially if everything in your document is in English.

If you make your document from a template, such as one of D2L’s Accessible HTML Templates, you may already have the document language set, probably to English.

Set or Change the Document Language

While editing a document, click the small “HTML Source Editor” icon in the lower right corner of Pilot’s HTML editor. The icon looks like a slash sandwiched between a less-than sign and a greater-than sign: </>

In the HTML Source Editor that pops up, you’ll see a line near the top that has <html> in it. Change that to <html lang="en"> and click “Save.” The “en” represents English. If your document is in another language, replace the “en” with another code, such as “es” for Spanish or “fr” for French.

A Different Language within a Document

Sometimes you have a word or phrase within an HTML page that is in a language different from the rest of the page. It might be a saying, or a title of a book or song. To prevent a screen reader from trying to pronounce French words as if they were English, you’ll want to mark the text in one of the ways that follows.

Set the Language of an Existing Tag

You can add a language attribute to an HTML tag to define the language of everything within that tag. For instance, suppose you had a paragraph in Spanish. The whole paragraph would be enclosed in a “p” tag, like this: <p>No hablo español.</p>

You can add a language attribute to the opening tag, just like you would for the <html> tag. It would become <p lang="es">No hablo español.</p>

Set the Language of a Words within a Block of Text

If you have words within a paragraph, you will need to add span tags. For example:

<p>Frederic said "No hablo español" when Lisa questioned him in Spanish.</p>

Add the span tag:

<p>Frederic said "<span lang="es">No hablo español</span>" when Lisa questioned him in Spanish.</p>

Sample Language Codes

Language ISO Code
Chinese zh
Dutch nl
English en
French fr
German de
Greek el
Hindi hi
Italian it
Japanese ja
Korean ko
Polish pl
Russian ru
Spanish es
Swedish sv
Thai th

For a more complete list of ISO language codes, see W3Schools’ HTML Language Code Reference.