Are You Receiving the Accessibility Tips and Tricks?
- Learn to make information accessible to people with disabilities
- Implement what you learn right away
- Understand how people with disabilities use technology
- Receive our monthly newsletter packed with news, articles and updates
- Bonus workbook: Ten steps to a more accessible web site
Do you need help with accessibility? Hire us!
Defining The Language of Your Web Page
When you create a web page, it is not enough to write in a particular language. It is also important to programmatically define the language you are using.
How to Define the Language of your Pages
This task is actually very simple. You only need to place the lang attribute in the <HTML> tag of your page. The value of your lang attribute is the language of your page.
Here is a sample code of an HTML tag with the lang attribute:
<html lang=”en”>
In this example, the lang attribute has a value of “en”, which represents English.
A complete list of language codes is available at the HTMLQuick.com site.
Important note: the above example is appropriate only for pages having one default language.
If you have a page that has content in more than one language, here is what you can do. First, define the default language using the format above. Then, locate the contents displayed in another language and define the language for them.
Here is an example: Let us say you are creating an English-German dictionary. The default language of your page is English, but it has a number of words in German.
You first have to define your default language:
<html lang=”en”>
Then find the words in German and define their language. In this example, the German word for “airplane” is in the <p> tag.
<p lang=”de”>
Flugzeug
</p>
An Illustrative Example
Below is a table containing five words in English with their corresponding meanings in German. This table makes use of the lang attribute. So, if you use a screen reader and listen to the German words, you would hear it pronounce the words in a German accent.
| English | German |
|---|---|
| Airport | Flughafen |
| Dog | Hund |
| Friend | Freund |
| Hospital | Krankenhaus |
| Water | Wasser |
Here is an audio version of this small dictionary which opens in a new window, so you can listen to how a screen reader reads the words in the table.
Why Define the Language of Your Page
As shown in the previous example, assistive technology would be able to represent information more accurately if you define your page’s language. This contributes a good deal to the accessibility of your website. Your site will also be displayed more accurately in search results. Search engines such as Google provide their users a way to search for websites in a particular language. If you define the language of your pages, more people would be able to find your website.








Post new comment