Creating multilingual websites in WordPress


The purpose of this post is to show a tutorial about creating a multilingual website in WordPress using the multisite feature.

Advantages of the proposed solution :

  • Lots of flexibility for content translation and presentation of the articles in different languages
  • Different themes based on country
  • Search Engine Optimization

Step 1 : Creating multisite WordPress

Add the following line in wp-config.php.

This will activate a new option in the Dashboard: Tools -> Network Setup.

All that’s left is to follow the instructions.

Choose the default folder options in order to have urls of the following pattern www.monsite.com/fr/mapage.html

2 actions are necessary :

  • Copy/Paste some code inside wp-config.php
  • Copy/Paste some code inside .htaccess

Note : make sure that the wp-config.php file has been updated between the first modification and the activation of the multisite.

Step 2 : Add sub-sites

Every sub-site will correspond to a specific language.

Create as many sub-site as languages you need to support.

Every code of the sub-site must correspond to 2 letters of the supported language.

Capture

Configure every sub-site with the corresponding language.

Step 3 : Add the plugin Multisite Language Switcher

Go to the network administration and add the plugin MultiSite Language Switcher.

This extension allows to relate categories, pages, articles, … with different languages.

Activate this extension in every sub-site corresponding to a specific language.

A widget allows to show the user a selection of languages on each page.

To configure this widget go to Tools -> Multi language Switcher

Step 4 : redirect based on the browser’s preferred language

This step could be achieved with the theme oncleben31-Multisite-Language-Switcher-Theme.

Configure this theme on the main site so that the redirect to the sub-site is made automatically.

Add and activate the theme from the network administration.

Leave a comment

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