Internationalisation (i18n) – WordPress

As part of my ongoing work for Vespe and their retail of match fishing products I am being asked to create a multilingual WordPress site or alternatively a set of sites all in different languages. The question is what is the best option for this and how well will it work with a plugin such as the IQ Block Country Plugin. The most important consideration is the internationalisation of the WordPress themes and custom plugins.

Internationalisation (i18n)

In terms of WordPress development internationalisation is the process of ensuring that a WordPress theme can be translated into different languages. For i18n WordPress uses the gettext tools and libraries. Gettext is designed to allow for display text in a programmers native tongue. It uses .mo files to replace strings of text with their appropriate translations. Its application within a WordPress theme or plugin is relatively straight forward. The documentation on the WordPress website covers all aspects of string translation including differentiation between strings and variables in text output.

Language Files

What I did not understand after reading the WordPress documentation was how to create the .mo files. Everything else was clear and well documented. After a bit more reading a solution was located. There are apparently three language files. These are POT, .mo and .po. The only file you need to create is a POT file. There is a free cross platform editor called Poedit that can be used to create your files. Poedit can scan an entire theme/directory for translatable strings. All you need to do is input your desired translations and then save and export the file in the various formats. This article on details how Poedit can be used with a WordPress theme that has been prepared for internationalisation.