462 Chapter 27 – Internationalization
HTML 4.0 Language Tags
Web Design in a Nutshell, eMatter Edition
Directionality
An internationalized HTML standard would also need to take into account that
many languages read from right to left. Directionality is part of a character’s
encoding within Unicode.
The HTML 4.0 Specification provides the newdirattribute for specifying the
direction in which the text should be interpreted. It can be used in conjunction
with thelangattribute and may be added within the tags of most elements. The
accepted value for direction is eitherltr for left-to-right, or rtlfor right-to-left.
For example, the following code would set a paragraph in Arabic, reading from
right to left:
<P LANG="ar" DIR="rtl">...</P>
There is also a new tag introduced in HTML 4.0 specifically dealing with docu-
ments that contain combinations of left- and right-reading text (bi-directional text,
or Bidi for short). The<bdo>tag is used for “bi-directional override,” in other
words, to specify a span of text that should override the intrinsic direction (as
inherited from Unicode) of the text it contains. The<bdo>tag takes thedir
attribute as follows:
<BDO DIR="ltr">English phrase in an otherwise Hebrew text</BDO>
...
ga Irish no Norwegian uz Uzbek
gd Scots Gaelic
gl Galician oc Occitan vi Vietnamese
gn Guarani om (Afan) Oromo vo Volapuk
gu Gujarati or Oriya
wo Wolof
ha Hausa pa Punjabi
he Hebrew
(formerly iw)
pl Polish xh Xhosa
hi Hindi ps Pashto, Pushto
hr Croatian pt Portuguese yi Yiddish
(formerly ji)
hu Hungarian yo Yoruba
hy Armenian qu Quechua
za Zhuang
rm Rhaeto-
Romance
zh Chinese
zu Zulu
Table 27-1: Code for the Representation of Names of Languages (continued)
Code Country Code Country Code Country