WordPress i18n and Localization

WordPress is arguably the world’s leading content management system (CMS) in use today (some even argue that WordPress is much more than a CMS), powering over 60 million websites globally.

By default, WordPress is presented in U.S. English (en_US), but it does come with a built-in language capability. This has allowed the WordPress community to translate WordPress into several languages. WordPress themes, translation files and support have also been made available in various languages.

WordPress i18n Support

WordPress uses the gettext libraries and tools for internationalization (i18n).
It is the libraries that facilitate the internationalization of WordPress, themes and plugins.

Note: i18n is an abbreviation for internationalization and it’s called i18n because there are 18 letters between “i” and “n”.

If you are not familiar with the concept of i18N, translations, and Gettext, I strongly encourage you to read this series on localization to have an understanding of what’s involved.

In this article, I’ll cover the basics of WordPress i18n. I am going to walk you through the simple process of installing a localized version of WordPress (WordPress in your own language), and also show you how to turn an existing WordPress site to a localized version.

Installing a Localized Version of WordPress

A lot of WordPress enthusiasts from different parts of the World have teamed-up to translate WordPress into their various languages.

For example, the French, German and Italian localized version of WordPress is available at fr.wordpress.org, de.wordpress.org and it.wordpress.org respectively.

Let’s see how we can install a localized WordPress using the German internationalization as our benchmark for this tutorial.

  1. Head over to de.wordpress.org and download the German’s WordPress.
  2. FTP/SFTP into your web server and unzip the WordPress package to your preferred installation directory.
  3. Create a database for WordPress on your web server, and a MySQL user with all privileges.
  4. Edit the wp-config.php file and add your database information.
  5. Run the WordPress installation script by accessing the URL in a web browser.
  6. You should have the WordPress in German up and running.

You might also want to check out the WordPress codex for other ways of installing WordPress.

A full list of WordPress versions available in other languages is available at WP Central.

Turning an Existing WordPress Site into an International Version

Let’s assume you are German and you have an existing WordPress website in English, but you weren’t aware that a German version of WordPress existed until you read this article. Based on this new found knowledge, you have decided to shake things up by changing your WordPress site from the default English version to a German translation. You might think it’s a very difficult task, but let me shock you a little. The entire process is as easy as following through the guide below, you don’t even need to reinstall WordPress.

Continue reading to learn how to turn an existing WordPress blog to your own language (German as a case study).

Download your language’s .mo file from the WordPress translation repository available at i18n.svn.wordpress.org. Get the German’s .mo language file here.

The .mo files are machine-readable, binary files that the gettext functions actually use for translation.

The naming convention of the .mo files is based on the ISO–639 language code (e.g. pt for Portuguese) followed by the ISO–3166 country code (e.g. PT for Portugal or BR for Brazil). So, the Brazilian Portuguese file would be called pt_BR.mo, and a non-specific Portuguese file would be called pt.mo.
Hence, the German’s language file would be named de_DE.mo.

A complete lists of codes can be found at (country codes) and (language codes).

Now that we have downloaded the language .mo file, we need to get it installed.
To install it, create a new folder in WordPress /wp-content installation directory called /languagesand upload the .mo file to the languages folder you just created.

Open the wp-config.php file and search for:

define ('WPLANG', '');

Edit this line according to the .mo file you have just downloaded. For example, using the German language, the name of the .mo file is used as the value of the PHP constant WPLANG:

define('WPLANG', 'de_DE');

Save and open your WordPress site. It should now display in the newly installed German language.

Something to Keep in Mind with Translation

I discovered that some terms were still displaying in English after the localizing one of my blogs to German. The reason is simply because the German .mo file at the WordPress translation repository lacks translation for those terms.

Thankfully, at the WordPress Updates page, I was provided a one-click installation option to automatically update the blog to the full-fledge localized German version.

WordPress German Language Example

Tip: To be sure you’ve downloaded an up-to-date language .mo file, it should be located in a version tagged folder. An example is the Spanish language .mo file for the current version of WordPress (3.9.1) located at i18n.svn.wordpress.org/es_ES/tags/3.9.1/messages/es_ES.mo.

Conclusion

Incredible features like this is what keeps the WordPress ecosystem thriving. People naturally feel comfortable working with a platform that’s extremely flexible, and the WordPress community keeps taking flexibility to a whole new level. The ability to use WordPress in your preferred language is an important feature, and as you’ve seen, one that’s very easily achieved.

Do you have any questions or contributions? I’ll be happy to respond to them in the comments.

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

No Reader comments

Comments on this post are closed.