Dec 05 2011

Howto: Multilingual WordPress

Installation of WPML

After having tried several different multilingual plugins, I found out that two of the best plugins were qTranslate and WPML. I wasn’ t quite satisfied with qTranslate so I decided to try WPML. However, WPML has gone commercial so it is difficult to find an older version that is still free. The latest free version is 2.0.4.1 and all releases after that are commercial. The download link is well hidden on the site but you may find it using Google. Once downloaded unzip it to [your-blog-root]/wp-content/plugins/sitepress-multilingual-cms. *** UPDATE Jan-01-2012 *** I tried to install WPML v. 2.0.4.1 on a WordPress 3.3.1 but it didn’t work. So as far as I know, the latest version of WordPress that works with the old free WPML is 3.2.1.

Login to your WordPress. If your theme does not include link to the admin Dashboard, use [your-blog-address]/wp-login.php. In the Dashboard select Plugins and activate WPML Multilingual CMS plugin. It gives you the option to view a quick tour of the features (goes to wpml.org) so you may want to browse it through if you are new to the plugin.

Configuring WPML

The configuration is really easy. You’ll need to set up:

  1. What language the existing content is written in.
  2. Languages that you want to support in your blog.
  3. The language switcher that enables the users to easily switch between different languages. Adjust it to your needs.
You need to drag-and-drop the Language Selector to the desired position in your theme. To do that select Appearance → Widgets.

Translating the Blog

The Content

First thing you’ll notice when trying the language switcher that there is no content in your language and that the UI (menus, titles) has not been translated at all. Adding content in your language is easy: just open up an old post or write a new one. On the right you’ll find a language section and there a plus sign under “Translate yourself”. Just click there and write your translation.

The UI

Using *.mo Files

Please refer to WordPress in Your Own Language. Download your localized version of WordPress, extract it and copy your language *.mo file (machine object binary) to [your-blog-root]/wp-content/languages (create the directory it if necessary). Make sure that it is named correctly (for example Finnish = fi_FI.mo). Check that WPML finds the file: Dashboard → WPML → Themes and Plugin Localization. It should say “File exists” under “Language locale settings”. Additionally some themes may have binary translation files (*.mo) available.

Translating Yourself

Select WPML from the Dashboard (it should be at the bottom). Select “String Translation” and you’ll see a list of UI strings that need to be translated. Just click “translate” next to a word and you’ll be able to write translations for the languages of your blog.

The theme can be translated selecting WPML → Theme and plugins localization. If you choose to translate the theme by WPML, it will scan the sources and present you the strings to be translated.

Customizing WordPress Translation

You may want to change a particular part from the readily translated WordPress. I wanted to change how short month names were displayed in Finnish. In English they are always three characters long (“Jan”, “Feb”, “Mar”, etc.). Unix Finnish locale (which for example PHP uses) has short month names as “tammi” (short for tammikuu), “helmi” (short for helmikuu), etc., “kuu” meaning “a month”. WordPress, however, does not use Unix locales but its *.mo files instead. In the official WP Finnish translation file the short month names are three characters long (“Tam”, “Hel”, “Maa”) that I find rather odd. “Maa”, “Huh”, “Tou”, “Hei”, “Syy” and “Jou” sound funny and I am not sure they are immediately associated with the months. Therefor I decided to change the WP translation according to the Unix locale. Here’s how I did it:

  1. Get the translation text file *.po from the official translated WP package.
  2. Use poedit to edit the bits of the translation.
  3. Compile the *.mo binary file using poedit. There is no command/button for compilation which I found strange. You should go File → Preferences… → Editor → Check “Automatically compile .mo file on save”.
  4. Copy and replace the *.mo file in your WP installation.

The Tagline

The tagline is the subtitle under the name of your blog. This can be easily translated with WPML. Go to WPML → String Translation → Search for the tagline using some words in it → Click “translations” on the tagline row → Type in your translation to the opening space and select “Translation is complete” → Save.

Leave a Reply