WordPress Cyber Monday Deals 2021!

WordPress MultiLingual Sites – How to Build using WPML

Is WordPress capable of handling the intricacies of Multilingual websites? The short answer is a resounding YES! Let's explore how to build a multilingual theme and website together in this guide.

Is WordPress capable of handling the intricacies of Multilingual websites? The short answer is a resounding YES! Let’s explore how to build a multilingual theme and website together in this guide.

Step 1: Choosing a MultiLanguage Plugin

First of all, we need to understand that WordPress in itself does not come with any multilanguage features. You will need to install a plugin to really get going. There are a number of alternatives, which we have already discussed in a previous post about WordPress multilanguage plugins. For this tutorial we will be using WPML, which is probably the most supported and fully featured of all WP multilanguage plugins.

WPML has recently made the transition from being a free plugin to being a paid plugin. Although we would always like things to be free, I believe the improvements brought about by the change are worth the cost. The code is now much cleaner and more secure. Moreover they have the divided the plugin into several smaller plugins which can be enabled on demand, thus reducing the load on your server. The switch to a commercial model will also enable the WPML team to focus more on support and improving the plugin. According to their website, the next releases will improve interoperability with popular plugins such as W3TC, AIOSEOP, Shopp, WP E-Commerce and NextGen Gallery. We definitely look forward to such improvements.

The first step to Multilanguage nirvana is thus purchasing WPML and installing it on your site. For a start, I recommend you install the following:

  • WPML Multilingual CMS (the core plugin)
  • WPML String Translation (add-on)
  • WPML Translation Management (add-on)

Step 2: Translating the Theme

If you have downloaded a free theme or purchased one, chances are that it is already set up to be multilanguage compatible. If however you are creating the theme yourself you need to make sure to implement some minor changes in order to transform it into a multilingual theme. The nice thing about WPML is that you don’t need to create any .mo or .po files yourself, all this is handled by the WPML String Translation add-on.

WPML provide 2 excellent guides on how to create a multilingual theme, so we won’t be repeating the information here. It is worth mentioning that themes should use GetText for localisation. Take a look at the WPML guides:

https://wpml.org/documentation/support/creating-multilingual-wordpress-themes/

https://wpml.org/2009/05/wordpress-theme-localization/

Linking to the Home Page

When linking to the Home page of your site, you need to use the following function to load the correct language according to what the user had selected:

<a href="<?php echo wpml_get_home_url() ?>">

Using Hard Coded Links in the Theme

If you are including any hard coded links in your theme, you need to use this:

wpml_link_to_element($element_id, $element_type='post', $link_text='', $optional_parameters=array(), $anchor='');

More info on this here:

https://wpml.org/documentation/support/creating-multilingual-wordpress-themes/hard-coded-theme-links/

Returning the Right Contents Per Language

When getting posts into a page or post template (for example to display a few featured posts), you need to adjust the IDs to reflect the language that has been selected. You can use the following code for this:

wpml_get_object_id($element_id, $element_type='post', $return_original_if_missing=false, $ulanguage_code=null);

Other Plugins that Can Be Useful

Amir Helzer of WPML has recently penned an article entitle 9 Killer Plugins for a WordPress Multilingual Website, you should definitely check it out for more ideas about plugins you can use when building a multilanguage site in WordPress.

Do you have any experience building multilingual sites with WordPress? Have you used WPML or other plugins for the job? Share your experience in the comments section!

Jean Galea
Jean Galea
Jean Galea is an investor, entrepreneur, and blogger. He is the founder of WP Mayor, the plugins WP RSS Aggregator and Spotlight, as well as the Mastermind.fm podcast. His personal blog can be found at jeangalea.com.

Consider sharing this post so others can find it:

Share on facebook
Share on twitter
Share on linkedin
Share on reddit
Share on telegram
Share on whatsapp
Share on pocket
Share on email

Join thousands of people receiving real-world, genuine evaluations of WordPress products and services just like this one every week.

Our Sponsors
Solid Affiliate
Contents

15 Responses

  1. Hey, I’m assuming there’s a way to have strings in the template translated that’s more elegant than using “if( ‘en’ == ICL_LANGUAGE_CODE )”.

    Could you share some knowledge on that?

  2. Do you know of any WordPress multilingual-ready themes? I guess it would be easier for noobs like me to have a theme with inbuilt translation functionality rather than having to install a plugin.

    1. Yes we will be releasing a round up of themes which have the translation functionality in-built, however you should know that it is also very easy to use WPML with any well-coded theme out there.

  3. Is WordPress and it’s WPML plugin as good or better at handling languages than, say, Drupal or Joomla … or are they all the same? What about non-common languages like Malagasy.

    1. I don’t have much experience doing multilingual Drupal or Joomla, but what I can say is that WordPress + WPML can pretty much handle any language you can throw at it impressively well.

  4. Hi Jean,

    Nice review !

    How come if it’s so easy to make a multilingual WordPress site, there is so less examples in the marktet ?

    Didier

    1. Hi Didier, thanks! It may be easy to set up a multilingual site, but the truth is that it takes a lot of hard work to create content in multiple languages, so that might be a reason why many people shy away from it.

  5. hello i’m using wpml with this theme http://demo.s5themes.com/?theme=time
    In the theme I’m setting a Page as homepage for the site, of course to set different pages for each language section, but the theme does not allow to specify the hp page for each language… what should code should I add in the theme to change the page according to the language? I always use the translation of the same page.
    If it’s not possibile, do you know of any multilingual theme that looks similar, so that I can change theme? You mentioned you were developing multilingual themes…

    Thanks

  6. Hey Guys!

    I am going to have my site ( https://bahargate.biz/ ) in other languages. Some of them are RTL such as Arabic and Farsi and some others are LTR.

    As Enfold is a translation ready theme, could you guys let me know the steps (1- 2 – 3 …) I need to take to create my website in other languages. I’ll start with Farsi.

    Thanks,
    Mike

Leave a Reply

Your email address will not be published. Required fields are marked *

The Beginner’s Handbook
From an introduction on how WordPress works to our recommendations on products and services.
👋 Hey there! We're Gaby and Mark
Every week we share tutorials and genuine reviews of WordPress products and services in our newsletter.
Thousands of people read it!
We’d love for you to join.
We’d love for you to join. Here’s what you’ll be getting:

A single weekly email directly to your inbox.