RTL support in WordPress 2.1

January 7, 2007
by Ryan

Thanks to Sewar, Mani, and others, WordPress 2.1 will have better support for RTL languages. The mechanics of this support are quite simple. Currently, WordPress gets the current locale (let’s use “fa” as our example locale) and then looks in wp-content/languages/ for a file called fa.mo. fa.mo contains all of the Farsi string translations. WordPress 2.1 will also load fa.php after loading fa.mo. fa.php can contain any locale specific code the translator sees fit to include. Support for the Jalāli calendar could be included in this fashion, for example. Further, the global variable $text_direction can be set inside of fa.php. Setting it to ‘rtl’ will tell WordPress that the current locale is an RTL locale. For an RTL locale, WordPress will load wp-admin/rtl.css after loading wp-admin/wp-admin.css when displaying an admin page. When viewing a blog page, WordPress will look in the current theme for an rtl.css file and load it, if present, after loading the theme’s style.css. Themes can now build in RTL support by including an rtl.css alongside the usual style.css.

Maintainers of RTL languages are encouraged to include a locale specific php file that defines $text_direction and includes any other bits needed for a more complete localization.  Theme maintainers are encouraged to provide rtl.css files for their themes.

9 Responses
  1. January 7, 2007

    is visual rich editor RTL for default?

  2. January 7, 2007

    The RTE recognizes RTL locales and reorients accordingly. Buttons for changing the text direction on the fly are also added to the RTE for RTL locales.

  3. January 8, 2007

    It is good for rtl languages

  4. January 8, 2007

    Wait till you find out that languages can also run vertically. For fun, take a look at both sides of a Chinese banknote.

  5. January 8, 2007

    Well true, also Japanese is originally vertical. With Japanese they actually mix horizontal and vertical text in the newspapers where some titles are horizontal and the body text is vertical.

    But for most daily use Chinese and Japanese are running horizontally.

  6. January 9, 2007

    it is a good news for us. tnx a lot…

  7. January 12, 2007
    Behrad permalink

    thats gonnna be awesome :)

  8. January 18, 2007

    thanks
    it seems WP have trouble with link direction.
    when you add direction=rtl in css everything seems fine except english links with ().
    take a look here:http://hadi.wordpress.com/2007/01/19/wplink-direction/

Trackbacks & Pingbacks

  1. Notorious » Blog Archive » پشتیبانی از راست به چپ در wordpress 2.1

Comments are closed for this entry.