Home    Services    Company    Resources    Employment    Ordering  
 
  Article Centre
Newsletter
Tips For Translation
   Buyers
Translation Resources
Localization Resources
Multilingual SEM
Podcasts
Quizzes
 
 
Contact Information
  Phone:
519-256-8897

Toll Free:
1-877-PICK-WTB

E-mail:
 
 
Home > Resources > Localization Resources > Encoding

Language declaration, character encoding and directionality


Language declaration
Character encoding
Direction

Language declaration: how to declare the language in a html file

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:

Text direction

Left to right direction is the default direction. However, when creating web pages in languages like right to left languages like Arabic, hebrew, Urdu, etc, text direction will need to be declared in order for the text to display correctly.

To mark up the entire document: <html lang="ar" dir="rtl">

This will affect the entire document. All the text will be display from right to left.

The dir attribute can also be used to change the direction in the document body: paragraphs, tables, etc. E.g.: <table dir="ltr"> … </table>



 

Google
www www.wintranslation.com

copyright 2010 - wintranslation.com - Translation services