mardi 15 décembre 2009

Language tags in HTML and XML

 Most language tags consist of a two- or three-letter language subtag. Often this is followed by a two-letter or three-digit region subtag. RFC 5646 also allows for a number of additional subtags, where needed. These will be explained briefly in the next section, and include extended language, script, variant, extension and private-use subtags.

The golden rule when creating language tags is to keep the tag as short as possible. Avoid region, script or other subtags except where they add useful distinguishing information. For instance, use ja for Japanese and not ja-JP, unless there is a particular reason that you need to say that this is Japanese as spoken in Japan, rather than elsewhere. Examples:


Code
Language
Subtags
en
English
language
mas
Masai
language
fr-CA
French as used in Canada
language+region
es-419
Spanish as used in Latin America
language+region
zh-Hans
Chinese written with Simplified script
language+script



XML also provides a means to prevent inheritance of language using the empty string, ie. xml:lang="". Essentially, this says: I do not want to associate any language with this information.


Source : http://www.w3.org/International/articles/language-tags/

Aucun commentaire:

Enregistrer un commentaire