CSSJanus: Helping i18n and LTR to RTL

Tuesday, March 4, 2008

Have you ever been asked "but what about a Hebrew version?" Lindsey Simon has, so he decided to write a tool that would help with the task.

CSSJanus is CSS parser utility designed to aid the conversion of a website's layout from left-to-right (LTR) to right-to-left (RTL). The script was born out of a need to convert CSS for RTL languages when tables are not being used for layout (since tables will automatically reorder TD's in RTL). CSSJanus will change most of the obvious CSS property names and their values as well as some not-so-obvious ones (cursor, background-position %, etc...). The script is designed to offer flexibility to account for cases when you do not want to change certain rules which exist to account for bidirectional text display bugs, as well as situations where you may or may not want to flip annotations inside of the background url string. CSSJanus itself is not always enough to make a website that works in a LTR language context work in a RTL language all the way, but it is a start. We sat down with Lindsey to talk about the motivation of the tool, the challenges behind it, and a screencast showing it in action:

Check out a running Django-ified webapp version, and for the greatest detail of what gets flipped in CSS Janus, please have a look at the unit tests.