Bilingual blog (1)

06/05/2005

Why a bilingual blog? Well, you know, why blog at all. But I decided to blog, and really couldn't make up my mind about the language. Basically, I still feel more comfortable, less limited, writing in Hebrew. And, well, most people who know me, and therefore have any chance of reading me, speak Hebrew, so why bother. On the other hand, there're are some subject in which I hope to contribute (a bit, you know), to a wider community.

There are other people out there who blog bilingually, and some of them have actually tackled the question of how to make this more accessible for both themselves and their readers. Basically, the idea is somehow to mark the posts (and possibly other objects in the blog, such as categoried, links, themes...) with a language field, and then to use this flag to somehow make the language inflence the display of the blog.

With Hebrew, things are even more complicated then your normal English-French, English-German cases. First, there's the issue of text direction and alignment. I would want my Hebrew stuff to automatically be right-to-left. And then, there's the issue of people who don't have Hebrew support installed; those people should be able to see pages with no Hebrew in them at all, because it will look exteremly ugly (IE will also nudge them to install language pack, every time a page loads and sometimes more than once per page).

I do have some ambitious plan to solving all this (and even more; why not be able to select language dependent UI, that is, theme?). But for the time I've only handled the direction of the posts, this was critical, because I could hardly start to blog in Hebrew without that.

Forgot to mention, if you missed it, that I am using WordPress 1.5 as my blog platform.

The solution is based on Stephanie Booth's ideas. Basically you add language as a custom field to each of your posts (WP allows custom fields to posts). To make it easy to use, I hacked the writing page and added a drop-down list of languages, pretty much in the way stephanie discribes. I added a little javascript that changes the direction (rtl-ltr) of the input boxes, because firefox doesn't support direction change simply using CTRL+SHIFT (IE does, of course, so that wouldn't have been important).

I have changed the index page of my theme, or, more appropriately, William Pramana's theme "Golen Gray", so the post and post header will be in a div-block with a lang parameter, and I updated the stylesheet to behave differenly (in direction, alignment etc.), depending on the language. Again following Stephanie's idea, I also created a function that returns a languague-dependent date.

I am currently working on, or at least thinking of, solution to language flags for other blog objects.