Multilingual wordpress

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.

I am assuming you have setup wordpress either with fantastico (from your cpanel) or by downloading the latest wordpress version and following the installation instructions from wordpress.org.

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

Take note
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

Category: 

17 Comments

Great tutorial!

Quick question though, I assume the content has to be UTF-8 right?

There’s no way for the encoding to be different?

Thanks!

Dimitri,
no problem

as for live example, geoland was supposed to be bilingual but then I decided I would not be writing any articles in Greek so just the tutorial remained.

Thanx for the quick reply Giorgo :)

Same problem here, I dont think I can handle 2 languages myself, but, definately yes, this solves a great issue on wordpress.

Best,
df

I would appreciate your help guys.
I am trying to get Greek posts to work. All I get is ?????.

I have a clean installation through Fantastico.
Where am I supposed to upload the el.po

I am sorry for the newbie question

If you get just ?????? it probably means that the page content-type character set is not correct

I usually use
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

check in your theme and change it to this

As far as el.po goes I don't remember where you should put it. I have not kept the billingual wordpress only for a brief time. This question is better asked on the wordpress forums.

Indeed great tutorial Giorgo, thank you. I am just setting up a new WordPress installation and I have a small question about the location for the tag
I am trying to use wordpress-2.6.2 and tried to locate the file with something like that. Unfortunately nothing comes close to it. I did not install in the server yet, maybe more files will be generated when I do that.
This new WordPress installation with be only in Greek, maybe there is a simpler solution?
Thank you
Costas

Well that tutorial is very old unfortunately
and
I don't really follow the development of wordpress or the greek implementation anymore

sorry I can't be of help

Would having the same text, but in different languages have any duplicate content issues?

I am just wondering, because Google has their language translator, and I wondered if they ran it over sites, to test for duplicate content, using different languages?

I don't know... but one of our workers is based in France, and we want to launch our blog in French also, but we do have some worries about duplicate filter content etc...

Any Ideas on this?