View Single Post

  #8 (permalink)  
Old 05-02-10, 10:02 AM
jaikanth 123 jaikanth 123 is offline
New Member
 
Join Date: Jan 2010
Native Country: INDIA
Posts: 25
Default Re: language declaration

1. Declare the language as html attribute:
<html lang="en">, or <html lang="fr-CA">

Syntax: lang="primary code - subcode"
where the primary code is represented by two-letter language abbreviations ( e.g.: fr=French, en=English, ar=Arabic, zh=Chinese, etc. See here the entire list
The subcode is the two letter country code (e.g.: CA=Canada, US=United States or America, CN=China, HK=Hong-Kong, etc).
List with the country codes

2. Declare the language in the document head:
<meta http-equiv="Content-Language" content="en,fr,sp" />

3. Declare the language within the document:
E.g.: The French translation for <strong>thank you</strong> is <strong lang="fr">merci</strong>

The French translation for thank you is merci

Character encoding

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

Some of the popular character encoding are ISO 8859 series, Unicode, Big5, Gubiano (gb2312), etc.

The most common encoding, ISO 8859-1 (Latin 1) will work perfect for English and French and other roman based languages. Arabic characters could be encoded with 'Windows-1256' or 'ISO 8859-6' or 'UTF-8'.

Chinese characters will display properly if also using the GB2312 for simplified Chinese characters and Big5 for traditional Chinese characters ( Taiwan and Hong Kong).

If there are more languages on the same web page, UTF-8 is recommended as it supports most of the characters.

Choosing the right encoding is a very important part of creating an web page. These Chinese characters 五一�� 二五六 三三���� will look different if not using the right character encoding. This is page encoding is UTF-8 and the Chinese text looks OK. Using the wrong encoding will display only question marks instead of Chinese text.

E.g.: Using iso-8859-1 encoding to display Chinese and English characters:
Reply With Quote