How do you set up a billingual or multilingual wordpress blog ?
The truth is that wordpress has not been very active in keeping its international followers happy. Keeping a billingual wordpress site at least in the year 2006 was not an easy task. I figured how to do it after some struggle but I am still not completely satisfied with the solution, but figured it might be useful for some people trying to setup one for themselves.
I setup this English Greek wordpress blog but basically all of the stuff that I did should be the same for any other billingual wordpress.
Now for ÎºÎ±Ï„Î±internationalizing there are quite a few plugins that you can experiment with, if you want. I personally a tried a few but
Polyglot2 was the best choice for me but far from a perfect solution.
To install polyglot
Drop the polyglot.php and polyglot_flags in the plugins directory and then activate it from the admin panel.
Edit the polyglot.php to include the details of you languages and associated flags, which in the case of english and greek languages result in:
$polyglot_settings['knownlangs'] = array('en','el'); $polyglot_settings['flags']['el'] = 'el.png'; $polyglot_settings['trans']['el'] = 'Î•Î»Î»Î·Î½Î¹ÎºÎ¬';
Insert in wp-config.php the languages that you will be using like this:
define ('WPLANG', 'en'); define ('WPLANG', 'el');
Insert somewhere in your theme the polyglot_list_langs function call (I dropped it in sidebar.php)
You will also need to create the directory "languages" inside wp-includes and drop in there the .mo file for the extra language that you will be using (no need for the en.mo its the default language).
This is are the simple instructions. For polyglot to work its magic the theme you have chosen must me gettext ready. For in depth instructions and things that could go wrong look at the official plugin page
How to use polyglot
If you wrap your posts or text anywhere else with lang_xx tags then polyglot will only let them display when that xx language is chosen, in my case it would look something like this:
[ lang_en ]English text[ /lang_en ][ lang_el ]Î•Î»Î»Î·Î½Î¹ÎºÎ±[ /lang_el ]
You can also use this technique inside the category input boxes in wordpress admin area to get a billingual category and the title of your blog but then things get messy because you have to make every plug in obey the gettext rules, otherwise you will end up with feeds or sidebar widgets that look funny.
More about .po and .mo
You can download the el.mo and el.po in a zip archive for the Greek language, if you want other language look here. The .po files have all the phrases and their translation in plain text, and the .mo is the compiled machine translations that wordpress understands. I actually bundled both of them together just in case you need to translate extra definitions. In that case you will also need to download poedit and edit the .po file to your liking and then save the .po file (if done inside poedit the .mo file is automatically created)
In case you can't find a .po file for you language you can actually decompile a .mo file to .po using this command from within the poedit bin directory
msgunfmt [path_to_file.mo] > [path_to_file.po]
Hope it helps