Case Study: Creating A Multilingual WordPress Site

In this post I want to give you a case study on how to build a multi language blog to serve site visitors who do not speak your base language.

I’ve been called in by a number of clients recently to build these types of sites and I want to share with you the easiest way to do this.

Multilingual Plugin

There are a couple of techniques to build multilingual sites, but by far the easiest is to use the premium plugin available from WPML.org.

This is a brilliant little plugin that does most of the heavy lifting for you.  It’s a premium plugin at $29.00 for the blog license, this is the cut down simple version or $79.00 for the full monty CMS version.  I’m going to talk about the $79.00 version in this post because of the powerful theme and plugin localization functions.

Install and Config

It’s just like any other plugin to install, you download the file(s) from WPML.org and upload them to your site.  Because it’s a premium theme you need to add a license key into your config so you can obtain updates.

Once installed the next step is to select the desired languages you want to support.  You will have a default base language, for example English, and other supported languages such as French

Language Switcher

Once the plugin is installed you need to give the option to switch languages, and wpml gives you a language switcher widget, this can be installed in your sidebar, in your header or can be coded into your theme.  Check out this site I worked on for an example of what the switcher looks like.

Once your site visitor selects their desired language, WPML is aware of that language setting and displays the corresponding content, see below the types of content you can translate.

Post and Pages

Once WPML is installed you are given the option to then create a translation of all your posts and pages, once it is translated, the appropriate version will be displayed to your site visitors.

There are tools to manage the translation process and ensure all of your content is multilingual.  There are filtering systems so you can not bogged down by the many versions of  your content.

Internationalize Your Theme & Plugins

WPML comes with a brilliant tool called the string translator.  What this does is give you a list of strings it finds in your plugins and themes.  You can then set the appropriate translation

An Example: it’s probably easier to give you an example.  Perhaps your theme comes with a widget to show calendar dates, and the title of that widget is event calendar and that displays in the sidebar in English.  Using the string translation tool you would search for event calendar, this would return a hit from your theme files, you are then able to add translations into this tool so that if italian were selected the string calendario eventi would be returned.

Using the string translation tool you can go through all the plugins and theme items to ensure all content not just your posts and pages are translated

CAVEAT: I have found that certain dynamically generated content is not translated. for example if your theme pulls data back from a database table it sometimes struggles, in this event you can hard code items in your theme or plugins using this simple code

if (ICL_LANGUAGE_CODE == ‘en’){

do the english version

}

if(ICL_LANGUAGE_CODE == ‘fr’){

do the french version

}

Repeat this process for all languages you support, there are more elegant solutions to coding up themes, if you are a developer you may want to check out http://wpml.org/documentation/support/creating-multilingual-wordpress-themes/ but the solution above is the quick and easy way.

Many theme developers are making their themes WPML ready, check out this list http://wpml.org/documentation/theme-compatibility/

Menus

WPML CMS comes with an in-built feature that lets your code up multilingual menus.  So the idea is build a base menu then duplicate this changing strings and pointing to different pages or custom links depending upon language

Once the language selector is made the appropriate translated menu will be shown.

Sidebars

WPML comes with it’s own set of text widgets so you can control what text aspects are shown for which language, but if you want to set how other widgets display, check out widget logic.  Using this you can set which widgets is displayed depending upon conditional logic.  For example if you wanted a particular widget to only display to german readers set the following in the logic box

ICL_LANGUAGE_CODE == ‘de’

Comments

WPML will give you a translated comments box too so your none base language readers can understand how to join the conversation and leave comments for you.

Translation Services

The company behind WPML Icanlocalize has also embed professional translation tools in WPML, using this service you can get your content translated for you at what seems to me a pretty reasonable price.

You set the posts or pages (or strings translations for plugins and themes) into a queue, these are sent off to the translation service and your text is re-written for you and added back into your site.  I’ve not used this function other than to checkout the workflow, but it looks like a great solution to get your copy in a foreign langauge if you don’t have the resources to do it yourself.

Other Bits and Pieces

I’ve found the google translator service to be invaluable, whilst not 100% correct, it has helped me to translate menus and certain plugin strings http://translate.google.com/

Here is a list of the international language codes http://webpageworkshop.co.uk/main/language_codes

The WordPress Dashboard

You can set your dashboard to display in different languages too, so if you have a team of writers using different languages, the back end menus can be translated too.

Wrap up

WPML.org. is my recommended plugin of choice for multilingual sites, check it out.  If you are a bi-lingual country like Canada (En, FR), or live in a region with many people who have english as a second language (Southern US states En, Es) or are competing in a market where many languages are spoken like European Union (bg,cs,da,nl,en,et,fi,fr,de,el,hu,ga,it,lv,lt,mt,pl,pt,ro,sk,sl,es,sv) this may be invaluable to you.

I carry an official contractor status from WPML, so if you need help creating a multilingual site, check out this page for details

Image by mukluk

Get A No Obligation Quote

Do You Need Help With Your WooCommerce Site?

Click through to the next page and complete the form to get a free no obligation quote to fix any issue you are having with your WooCommerce site.