Easily create multilingual sites with WordPress

Some days ago, I had to build a multilingual website using WordPress and the WPML plugin. In this tutorial, I'm going to show you what I've done to make a website available in three different languages.

1 – Localize theme strings

Before installing a plugin on your blog, the first thing to do is to localize theme strings. PHP and the Gettext tool (which allow easy string translation) have two functions: _e() and __().

The only difference between _e() and __() is that _e() echo a string while __() is used to assign a string to a variable.

Let’s say your theme have the following code:

<div class="content">
    <h1>Welcome to my site!</h1>
    <p>I hope you'll like it.</p>
</div><!-- #content -->

What you have to do is to wrap all strings into the _e() or __() functions, as shown in the example below:

<div class="content">
    <h1><?php _e("Welcome to my site!"); ?></h1>
    <p><?php _e("I hope you'll like it."); ?></p>
</div><!-- #content -->

Once done, your string will be recognized by the WPML plugin (we’re going to install it) as translatable strings.

2 – Install and configure the WPML plugin

Now that your theme is fully localized, the next step is to install the WPML plugin, which will make our blog multilingual. Install the plugin using your WordPress dashboard, or get it here. Activate the plugin, then you’ll see a “WPML” link on your WordPress dashboard. Click on it and add at least one language.

3 – Translate theme strings

Once done, you now have to translate your theme strings in French. To do so, click on the “Theme and plugins localization” link located under the “WPML” tab. On the “Theme and plugins localization” page (See screenshot below) choose the Translate the theme by WPML option, so you’ll be able to directly provide translations in your WordPress dashboard. Though, if your prefer using a .mo file, the WPML plugin allows it as well, so feel free to choose your favorite option.

4 – Translate site content

Now, you have to translate your site/blog content. WPML provide an easy way to do it: Simply edit one of your posts or pages and have a look at the right side of the screen: you’ll see a box where you can create a translation for each of your posts and pages.

Translating your site content can take a while if your site have lots of pages, but thanks to the WPML plugin it is pretty easy to do.

5 – Translating your site menu

Right now, almost all your site is fully multilingual. Though, you still have to translate your navigation menu. To do so, simply go to “Appearance”, “Menus” and select your current menu. As you can see on the screenshot below, WPML has added some new options to allow you to create a new menu per language. How cool is that?

Right now, you should have a fully multilingual website. Hope you enjoyed this tutorial!

  • Thanks for this very helpful tutorial.
    I have a question: what about website with RTL languages like Arabic?
    Is this plugin ok for such situation?
    (Sorry for my bad English)

    • WPML can handle RTL languages, more info at http://wpml.org/2011/03/wpml-2-2-0-improved-translation-tools-1/

      • Thanks for you reply, Taeke Reijenga, but as I see they just solved the problem in the admin area, and I’m asking about the theme, because the should shift the direction page according to the choosed language in the website.
        In the link above there is: “…when you’re translating between LTR and RTL languages (no matter the order), the translation fields always display correctly”
        so as I see it’s just for the translation fields.
        Thanks again.

        • WPML can handle RTL languages, both in front- and backend.. Most of the work will be in css modifications which WPML will not do for you. Hope this makes things clearer

  • Great tutorial! We have been using WPML since the plugin was released and something I’m missing in the article is the use of the text domain. I’d highly recommend to use a second optional argument. By using this second argument you make sure that WordPress provides the right translation when a string is also used in WordPress or a plugin for example..

    The translatable string would look like:
    _e(“Welcome to my site!”,”theme_name”);

    Same goes for translation of plugins..

  • Does this plug-in have the ability to detect the geo-location of the users and then, translate the content for them?

    • Not according to IP, but by browser language setting. You can enable it in WPML->Languages.

  • Danilux

    I’ve wanting to know how to make my site English/Spanish and this would come handy, the only problem I encounter is that my navigation menu is a css sprite and the name of each nav link is hardcoded in the images.

    • keriati

      1. you have to make another sprite fort the new navigation
      2. translate the pages
      3. create a translation for the original menu
      4. add the translated pages to the new menu
      4. if you look at the source now, wordpress will give the new menu items new IDs, different from the original ones
      5. use the new IDs for css sprites

    • Generally, it’s better to have texts-only in the navigation (for different reasons).

      If you decide to stick with graphics, you can use WPML’s language constants to load the correct graphics per language.

  • This is great! Hope you can come up with more tutorials like this.

  • I always wondering how people do multilingual site and thanks for this tutorial for make it clear. Do I need to translate all post manually by using this plugin?

  • I have tried WPML for a project, but it doubled the database queries. Slowed downed the site to much, so I had to get rid of it. My solution instead was making the installation multi-site, the main site in Swedish and the english site a subsite to the mainsite. Giving it a URL of /en/ in the end.

    That worked good in my case. I am sure the double queries issue could have been fixed, but I didn’t really have the time to look into it. I needed a solution I knew that would work for my client. The WPML plugin is a great plugin, with lots and lots of awesome functions. Maybe I implemented it wrong, I don’t really know.

    • I would then recommend installing W3 Total Cache. It plays nicely with WPML, is currently the most powerful and fastest caching plug-in for WP, and, well, it definitely should get rid of most database queries… duplicate or not 🙂

  • Great tut. I’ll include this in my future themes.

  • I used this multi multilingual plugin quite recently but it seemed to cause weird side effects to my site – a bunch of stuff just started becoming glitchy – has anyone else had this experience?

  • And this works even on languages that don’t use traditional Roman characters?

    • You need to make sure that your DB tables use the (default) UTF-8 character encoding. This will support all character sets, including Latin, Asian and Russian.

      • We used the WPML plug-in for a customer in Thailand. Their site content is in English, Japanese and Thai languages and the plug-in works beautifully.

        I was a bit put off by the methods used by going from free to commercial, but overall, it has been a great time saver.

  • Hi, nice tutorial but the free version of the plugin doesn’t work with the current version of wordpress. Anyway even the uninstall routine of the plugin is a mess. You need to delete the customs tables from your database by hand.
    I don’t know if the commercial version is better, never tested it, but the free version isn’t good (in my humble opinion) 🙂

  • I tried WPML. It too slowed down the site. I felt not a good user experience, hence removed it in the end. But nonetheless, this tutorial is useful. I learned something.

  • What does Google say about automatic translation? Doesn’t it sense it and punish it somehow?

  • @Lukas
    I don’t think so that google punish for such act.

  • Patric


    Gr8 tutorial. Just set wordpress up with WPML. However, for some strange reason when I check the “Translate the theme by WPML” and then press save, it jumps back to “No localization”. I´ve been searching around for an solotion but been out of luck… Any ideas?


    • Make sure you have the WPML string translation plugin active and make use of the text domain as suggested in one of my earlier comments

      • Patric

        Might sound stupid, I´ve been looking around for this “string translation plugin”. But I cant find it anywhere? Please help me out…

  • Patric

    Ah, Its not included in the free version…

  • camparito

    I used to work with WPML to make multilingual sites with wordpress, but now im more into qTranslate.
    For the sites i had to craft, it has worked way better 🙂

    This is just my opinion.
    If you have to make a multilingual site with WP I suggest to compare both plugins before making a desicion.

  • Automatic translation is considered by Google as automatic generated content, which is something Google has announced it doesn’t like. Will it get a site banned or “punished”? It could, probably depends in part on how much of the site is made up of this auto-generated content.

  • Great tutorial, I’m still learning WordPress and this helps a lot.

  • I used qTranslate for my portfolio website and it’s pretty cool too. You can customize anything with a little knowledge about wordpress, php, css and html. I managed to make it completely multilingual.

  • WPML is a great plugin for multilingual sites, unfortunately WPML turn commercial and the free version is older. qTranslate work like a charm for me.

  • François

    Nice plugin but does anyone know how to use it with the plugin ‘wp custom fields search’ ?
    especially to run a search query with tags in other language than main language ?

  • Small problem, the plugin translates in two different ways,” /es/” and “/?lang=es”. Everything is fine in case of “?lang=es”. The problem arises when site translates with url “/es/”. It translates the db query string written in function.php. And also jcarousel is not working when the url is /es/.

    Can can one help.

    Thanks in advance.

  • WPML plugin is a real pain to use and has lots of bugs… if you need to do any complicated customisation on your site you will very quickly run into problems so I would steer well clear of this plugin. The customer support & documentation for what is a paid plugin is rubbish too… Save your self a lot of time and effort and just set up a separate install of WordPress for each language!

  • I want to translate my website into French language. I do not knows french Language, So I can not read, write , understand French. Is I, alone is able to translate this website using WPML plugin? Is there is automatic option is present in there?
    As I have tried once this plugin, I have not found any automatic function in it. One automatic function is that your files sent for translation & waiting to be translate . I have waited for 2 days , nothing happened,Either I have not used this plugin by a proper way? Or this plugin, alone is not sufficient to translate, the website?

    If this alone is not capable to translate website, then why is the option that your files are sent for translation?

  • QTranslate works okay for me on simple sites. The only problem is that is can fall behind the current WordPress version so I have to often update code myself. I find that none of the mainstream CSM (Drupal, Joomla, WordPress) do multilingual sites in a way that are easy to manage. Some of the newer CMS such as Django and Ubiquo do it right out of the box.

  • Mittul Chauhan

    WPML is so easy to use and wonderful.