- Getting Started
- What Are Character Sets?
- Unicode to the Rescue
- Language Attributes
Language Attributes
Once you've obtained your translated text and specified a suitable charset in a <META> tag, you're almost ready to publish your multilingual pages. One important step is to specify the necessary language attribute in the HTML tag. Two-letter primary codes are reserved for language abbreviations. For Japanese, the opening <HTML> tag in your document should appear as follows:
<HTML lang="ja">
You can further specify the language by following the code with a hyphen followed by a subcode:
<HTML lang="en-US"> |
The version of English spoken in the United States |
<HTML lang="en-GB"> |
The version of English spoken in the United Kingdom |
This helps differentiate dialects of the same language that may be spoken in different countries (for example, Canadian French versus that spoken in France).
You can also tag specific text blocks according to language. For example, <P lang="de"> indicates that the next paragraph is in German. As you continue to develop your multilingual sites, consider putting language or country codes to work in your naming conventions for files and directories in order to simplify keeping track of multiple versions of the same documents.
In the next article, we'll examine strategies for providing a gateway to the different language versions of your content as intuitively as possible for your audience.