RTL support in WordPress 2.1

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 thoughts on “RTL support in WordPress 2.1

  1. 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.

    Like this

  2. 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.

    Like this

Comments are closed.