A Bilingual blog

Making a blog bilingual is relatively straightforward. There are a variety of plugins available which allow you to provide your blog in two or more languages. Go to the wordpress translation and languages plugin page for more info.

They all use the gettext platform which is the GNU internationalization (i18n) library wikipedia.

A bit of gettext background

Gettext allows you to find all the natural language strings in a program by marking them up so they can be easily translated. (so string could become _e(‘string’) OR __(‘string’)). These strings are grabbed and put in a POT (portable object template), like a text file really.

Then translators come along turn the POT into a PO, and translate the strings so you end up with a French version; fr.po, a welsh version; cy.po, a British English version; en_GB.po etc. The POs are turned into MOs so they can be read by your program. And Voila! Bob’s yer Uncle you have a localised program in your language. More info on localizing wordpress

Before translation, documents have to be ‘gettexted’ as outlined above. WordPress has already gettextted its basic install. You need to make sure however, that your wordpress theme, pages and blog content have been gettexted too. Details of how you do that should be covered by the plugin documentation.

Polyglot and Language Switcher

Initially I chose Polyglot which worked really well in 2.0.5 after a few tweaks to the php files. However, after upgrading to 2.1.3 I tried to reactivate polyglot but certain sections of the site weren’t being translated.

In my original installation I’d changed some of the php functions to make sure everything could be translated. In WordPress 2.13 some of the php functions that I’d tweaked, had been changed in the upgrade. For instance the date functions are using all wp-locale, I couldn’t find where to ‘gettext’ the date. I’m sure its possible but I ran out of time.

Luckily, I found Language Switcher, a plugin that lives in a friendly hand-holding site called Poplar Software. Language Switcher, based on Polyglot, has been upgraded to work with WordPress 2.1.2 and above and has got really detailed yet easy to understand documentation. On uploading the software I found that all the “hackery” had been done for me and everything, even my illogical archive structure, was translated.