Setting up a MultiLingual WordPress Site with Polylang

You can set up a Multilingual WordPress site with a great plugin called Polylang, there are a few ways to make multilingual sites and people can get quite opinionated about this, for larger sites with complete duplication you may want to consider doing it with a multi-site set up but for smaller needs you can get away with a smaller set up.

One of the key things to note is that these plugins or set ups won’t translate your content into another language you still need to get your text translated and provided in the other language ready to be pasted into your page

This guide looks at setting up a mulitlingual site with a free plugin maintained by an active developer, first thing is to make sure the WordPress theme is Internationlised which essential means the theme is ready to be translated into other languages, a process known as localisation.

Polylang

Download and install Polylang activate it. Go to settings via the plugin or via Settings > Languages, here is where you add the desired languages.

polylang-language-selection

Chinese Language is selected in the above example

When you add the language the required .mo and .po files are downloaded and filed in wp-content/languages/

.po and .mo files downloaded

.po and .mo files downloaded

Now since this is a multilingual site as well as our other languages we also need to add in our default language which more than likely will be English add this in the same way and pick your English flavour, US, GB, CA or AUS. This will also determine the flag used on the language switcher.

polyland-second-language

English Added

Next is to swap to the Settings tab and set the default language.

Set default language

Set default language

Also here set your URL settings, I like to keep it simple and not set the language abbreviation in the URL and remove the word /languages/ from the URL string. This is also a safeguard in that if the plugin was deactivated I would still have all my links working for the default language.

It’s also worth pointing out here that all additional content added via Polylang for additional languages is stored additionally in the WordPress database so disabling the plugin leaves the core language and re-enabling the plugin adds back in all the other language content.

Set URLs

 

On a first time install you will also be asked There are posts, pages, categories or tags without language set. Do you want to set them all to default language ? Where you can set these to the default language.

On the middle tab string translations, certain WordPress settings, plugins and widgets are available where you can enter in the other languages text strings.

string-language-translations

 

Sorting out the Menus

Next up is to address any pre-existing menus, you need to resave the menu to the default language and create new menus for the other language. Additional theme locations are added per menu per language.

Saving Menus per language

Saving Menus per language

So if an exact duplicate menu is required for the 2nd language, create the menu and assign the 2nd language theme location.

Menu Switcher

menu-switcher

Polylang gives an option of adding a menu language switcher between the languages to add to the menu.

front-end-menu-switcher

Front End View

You will need to add the switcher to both language menus to be able to toggle between languages.

Widget Switching

polylang-widget

Widgets are handled by adding additional widgets in the appropriate areas and selecting whether you are displaying them for one or multiple languages.

Post & Pages Switching

post-page-switcher

Since we have already set default language on post/page/cat & tag (in the set up of the plugin) we have the content in it’s intended language to create an equivalent page in the other language  just click the translation pencil edit icon and add in your multilingual content.

These posts/pages are then available in the menus so you can add them into your other language menu.

For categories and tags the same procedure applies.

Flag Switcher

flag-switcher

As well as the menu switcher there is a widget switcher which can display a number of indicators to swap language which can be place in any widgetised area.

flag-switcher-front-end

Further ref.