In this fifth part of my series of articles on setting up a Multilingual WordPress site, we’ve looked at the basic requirements for setting up a Multilingual WordPress site, how to set up the Language Switcher plugin to allow us to create multilingual content and let the site visitor switch between the languages, and how to internationalise and localise the theme files.
The next steps are to:
- Set up WordPress to run in the two languages
- Troubleshoot any issues, eg with plugins
Setting up WordPress
Back in the first article in this series, I mentioned that we would be setting up a WordPress site to run in two languages – English and French. I also mentioned that the multilingual content is derived from the following:
- Posts and Pages which you write in the Dashboard.
- Your theme template files which often contain hardcoded text like headings, links etc.
- WordPress itself. The core WordPress files also generate text which is displayed in the browser, for example the “More” tag and the “View all posts in this category” menu mouseover text.
So far in this series, we have dealt with the first two of these three points. We now need to deal with WordPress itself.
Adding languages in wp-config.php
As mentioned in point 3 above, some text which is displayed in the browser is derived not from theme files, but from WordPress core files. Assuming that we want this text to be displayed in the relevant language, we need to enable WordPress to work with a second language, in our example, French.
Open up wp-config.php and look for this code:
/** * WordPress Localized Language, defaults to English. * * Change this to localize WordPress. A corresponding MO file for the chosen * language must be installed to wp-content/languages. For example, install * de.mo to wp-content/languages and set WPLANG to 'de' to enable German * language support. */ define ('WPLANG', '');
In order to enable French, we change this:
define ('WPLANG', '');
define ('WPLANG', 'fr_FR');
Adding WordPress language file
The next step is to download the relevant WordPress language file. Access to the latest versions of WordPress language files can be found here: http://codex.wordpress.org/WordPress_in_Your_Language.
Download the language file and upload it to your /wp-content/languages/ folder. The sub-folder languages is not created automatically during WordPress installation, so you will probably have to create this folder manually.
Login to WP admin and you should now see the Dashboard in the second language. (You can switch between English and the second language using the dropdown menu at the top of the Dashboard pages).
Assuming you have followed all of the steps in these articles, you should now have a fully functioning multilingual WordPress site.
In the next, and final, part of this series we shall look at how to troubleshoot issues with plugins.
- Setting up a multilingual Wordpress site
- Multilingual Wordpress - Language Switcher plugin
- Multilingual Wordpress - Internationalising themes
- Multilingual Wordpress - Localising themes
- Multilingual Wordpress - Setting up Wordpress