The IBM® Toolbox for Java™ BidiOrdering class represents an HTML tag that alters the language and direction of text. An HTML <BDO> string requires two attributes, one for language and the other for the direction of the text.
The BidiOrdering class allows you to:
For more information about using the <BDO> HTML tag, see the W3C
Web site.
// Create a BidiOrdering object and set the language and direction.
BidiOrdering bdo = new BidiOrdering();
bdo.setDirection(HTMLConstants.RTL);
bdo.setLanguage("AR");
// Create some text.
HTMLText text = new HTMLText("Some Arabic Text.");
text.setBold(true);
// Add the text to the BidiOrdering and get the HTML tag.
bdo.addItem(text);
bdo.getTag();
The print statement produces the following tag:
<bdo lang="AR" dir="rtl">
<b>Some Arabic Text.</b>
</bdo>
When you use this tag in an HTML page, browsers that can understand the <BDO> tag display the example like this:
.txeT cibarA emoS