The Complete Guide To A Multilingual WordPress Site

Adding multilingual functionality to your WordPress website is easier than ever. Thanks to the growth of the WordPress core and a handful of well-configured plugins you can now create a website with any number of languages and very little effort.

This is a stark contrast with the options we had a few years ago, where you had to hack your way through just to translate all the content on your site. In this guide, we’ll take a look at how you can effectively add multiple languages to your WordPress install.

How To Create a Multilingual Site

One important thing to note is the way a multilingual WordPress site should be created: with a translation plugin. Some may argue that creating a WordPress Multisite installation is better than having to manage everything with a plugin. However, we highly recommend against it.

First off, WordPress Multisite was not originally intended for creating multilingual websites. It is geared towards creating multiple different websites out of a single WordPress install, such as communities or blog networks. This needlessly complicates things when dealing with translations. For instance, you have to manually configure users and permissions everytime you want to add a new language, or you may also lack the tight content integration that a multilingual plugin offers.

Most translation plugins nowadays offer a solid array of tools to keep track of the translated content in your site. If you happen to have a particularly high number of posts, these management tools become indispensable to keep everything up to date. Multisite doesn’t offer any of this and instead, makes everything harder to manage thanks to the added complexity of having to setup the same plugins and themes for each site.

Installing a Translation Plugin

The WPML Logo.
The WPML Logo.

The first step towards translating your website is to choose a multilingual plugin. We personally prefer WPML, which we consider is the best translation plugin by far. While it is a premium plugin that comes at a price, we find it pays itself many times over thanks to its vast array of options. For the purposes of this guide, though, we will be using WPML as it makes everything far easier.

Free Alternatives To WPML

If you don’t like the idea of using a premium plugin, there are a few free alternatives to WPML. You can also use these to translate your website but may lack the premium-level support of a paid plugin. The free options ae:

qTranslate

This plugin is the most popular one among the free WordPress translation plugins out there. It has a long history and has been updated pretty frequently so far. qTranslate separates multiple languages in a single post by using proprietary tags, making for quick switching between languages. One word of caution: if you deactivate the plugin, you might end up with posts having all languages stuffed into the content.

View Plugin

Weglot Translate

Weglot is an incredible free plugin which you can use to easily translate your website and make it multilingual. Once you install the plugin, it will identify and translate your content into the languages you selected upon installation. Afterwards you can go to the plugin’s dashboard and make the changes you want to those automatic translations. A more intuitive and user friendly translation plugin you will not find!

View Plugin

Polylang

Polylang is a bit younger than qTranslate but is coming along quite nicely. It creates entirely different posts for each defined language, which makes everything a bit cleaner. However, it has a bit of a steep learning curve, as it doesn’t come with an installation wizard that lets you set up everything right from the start.

View Plugin

Translating Your Site

Once you have installed and activated your translation plugin, you’re ready to start translating your content. With that being said, your content is comprised of more than just posts and pages. There are a few things you should watch for in order to fully translate your site, as well as some important pitfalls that beginners often get stuck with. Let’s take a look at them:

Translating Posts

Translating individual posts is fairly straightforward. Once you install the plugin and add the desired languages through the plugin settings, you should be able to see some translation options in the post edit screen. In the case of WPML, you should see something like this:

wpml-translation-box

Alternatively, you can also access your translated posts directly from the post listing:

wpml-translate-posts

Both WPML and Polylang will create entirely independent posts for each translation you create. This ensures each translation can have its own content without being dependent on the original one, and thus have different URLs for each one of them.

Translating Metadata

After translating a post, you need to remember to translate all post metadata too. If you have stored any information as custom fields in a post, you should replicate (or at translate them, if they contain texts) them as well. Some translation plugins may help you out here and let you automatically duplicate your post metadata.

If you’re using a theme that comes with built-in custom fields, chances are you don’t need to do anything special besides filling them out. Because translations are stored as entirely independent posts, their metadata will be correctly assigned to them when saving your changes.

Translating Attachments And Featured Images

Post attachments need to be translated as well. Essentially, a post attachment is any file that has been uploaded to the post page. Doing so will mark the file as belonging to that post. While not necessary, attachments may be used in themes to create rich media experiences such as galleries or slideshows, so it’s a good idea to replicate them. This also applies to featured images, since their use is entirely decided by the theme you’re using and may be an important part of the design.

By filtering the Add Media popup window, you can see which files are attached to a post.
By filtering the Add Media popup window, you can see which files are attached to a post.

To translate attachments all you need to do is upload the same files to the translated post. Tedious, isn’t it? Since this may result in multiple copies of the same file on your server, your plugin of choice may automatically reuse that file and create multiple attachment entries for that single file. In WPML’s case, if you have the WPML Media Translation addon you can do this automatically, without having to upload your files all over again.

You can always check which files are attached to a post by opening the Add Media window, and filtering files by ‘Attached To This Post’.

Translating Widgets

A WordPress widget using the Widget Logic plugin.
A WordPress widget using the Widget Logic plugin.

One tricky part of translating your website is the widget areas. Most translation plugins don’t offer a specific solution to this– even WPML doesn’t provide an in-built solution for this yet. You will need to do a little digging and install some additional plugins to make your widgets multilingual.

To translate your widgets, you can use the Widget Logic plugin. This nifty little addon allows you to add conditional statements to every active widget on your site, which you can use to detect the current language and change them accordingly. When using WPML, all you need to do is fill out the field that is created by the plugin on each widget with the following:

ICL_LANGUAGE_CODE==en

Where ‘en’ is the code of the language you want the widget to appear in. For example, if you’re translating to Spanish, the code would be ‘es’. French would be ‘fr’, and so on. Should you want a widget to appear in all languages, simply leave that field empty.

Translating Menus

WordPress menus follow roughly the same procedure as posts. You can create multiple menus for each active language, and even customize them to your liking. The latest version of WPML comes with an automatic for syncing menus between multiple languages. However, if you happen to have fairly complex menus I would avoid using it as it can be erratic at times. Always check that your menus are consistent from language to the language after creating translations.

WordPress menu translations act very similar to posts.
WordPress menu translations act very similar to posts.

Translating The Theme Options

This is the trickiest part of making your site multilingual. Most themes nowadays include at least an options page where you can configure all the site styling, appearance, and so on. However, it is up to the theme author to provide support for a multilingual theme options page, as some settings may require different values across different languages. For example, our premium themes provide full integration with WPML, allowing you to create multiple sets of options for each language. They also have a language switcher built directly into the site design.

wordpress-options-translation

If you plan to have a multilingual WordPress site, you should always check that your theme is multilingual compatible. It’s generally a good idea to go the extra mile and ask the author for the full capabilities of the theme. Doing so will not only save you time and money, it will also ensure you’ve made the right purchase.

Adding A Language Switcher

A very important part of making your site multilingual is to include a language switcher. You’ll want your visitors to have an easy way of switching between the different available languages, especially if they’re deep in your page hierarchy and don’t want to go back to the homepage.

WPML gives you a wide array of options to do this. If you go to the general settings page of the plugin (remember, WPML > Languages), you can find a section for configuring the language switcher. This special menu will display all your active languages automatically, with the advantage of always linking to the corresponding pages.

For example, if you’re browsing the About page, the language switcher will take care to directing you to the different versions of the same page. What’s more, if no translation is available, the switcher will hide links that take you nowhere.

You can install it in three different ways:

  1. You can simply tell WPML to add its own language switcher in one of the sidebars of your theme.
  2. You can manually insert the icl_language_selector code into the layout of your theme to better control its location.
  3. You can rely on your WordPress theme being integrated with WPML and doing all of this for you.

While inserting the language switcher in the sidebar is by far the simplest option is recommended that you always try to keep it visible and at the very top of your website. This may be good enough for blogs with a sidebar, but for full websites, it is preferable to have it in the header.

If you’re using a premium WordPress theme, chances are that it will provide support for this and save you all the work. If you’re using our premium themes, they will automatically embed a custom language switcher in the site header as soon as WPML is activated.

Closing Words

If you have followed this guide thoroughly, then virtually your entire site should be translated thanks to the WPML multilingual plugin.

One final word of caution: if you’re the least bit serious about having a multilingual WordPress site, please don’t use Google Translate to do it. Not only are automatic translations very inaccurate, they may also cause Google to penalize you for having essentially duplicate content. Always consider having an expert translator do the job instead.

Editorial Team

The editorial team watches over all the content that gets published on the MachoThemes blog. You can get in touch with us via our contact form. This author box is generated using Simple Author Box plugin, available for FREE on WordPress.org.