Bp spec bidi

From Internationalization
Revision as of 13:06, 25 July 2012 by Rishida (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Collaborative editing page

Follow the conventions for editing this page.

Status: Initial Draft ie. please focus on technical content, rather than wordsmithing at this stage.

See the [I18n Core home page].

Author: Richard Ishida

Draft Best Practices for Specification Developers

Handling text fragments

The following recommendations should be taken into account if you are working on a specification that passes around user-readable text in small chunks.


  1. It must be possible to indicate the language of the text as a whole.
  2. It should be possible to indicate parts of the text where the language changes.
  3. In a multilingual environment it must be possible for the user to receive text in the language they prefer. This may depend on implicit user preferences based on the user's system or browser setup, or on user settings explicitly negotiated with the user.

Text direction

  1. It must be possible to indicate the direction of the text as a whole, ie. set the overall base direction, to either ltr or rtl.
  2. It must be possible to also set the direction to auto. This means that the base direction will be determined by examining the text itself. A typical approach here would be to set the direction based on the first strong directional character outside of any markup.
  3. If the overall base direction is set to auto, the direction of the content should be determined on a paragraph by paragraph basis.
  4. It must be possible to indicate parts of the text where the base direction changes. If markup is available, this is the preferred method. Otherwise your specification must require that Unicode control characters are recognized by the receiving application, and correctly implemented.
  5. To indicate the start/end of a line or paragraph you should use 'start' and 'end' rather than 'left' and 'right'.
  6. To indicate the beginning and end of a block of text you should use 'before' and 'after', rather than 'top' and 'bottom'.

General bidi guidelines

  1. provide dedicated attributes for control of base direction and bidirectional overrides; do not rely on the user applying style properties to arbitrary markup to achieve bidi control
  2. allow bidi attributes on all elements that contain text content
  3. provide attributes that allow the user to (a) create an embedded base direction or (b) override the bidirectional algorithm altogether; the attribute should allow the user to set the direction to ltr or rtl in either of these two scenarios.
  4. declare the default base direction of the document to be LTR.
  5. make it possible to set the base direction on the top level element in a document
  6. ensure that the base direction set on an element is applied to all contained elements and text (unless, of course, the base direction is changed by a contained element using the directional attributes)
  7. provide a span-like element that can be used for any text content to change the base direction in the absence of other markup
  8. avoid natural language text in elements that only allow for plain text and in attribute values.