WordPress themes are used by people all over the world. Luckily, it is relatively easy to localize your theme by modifying code. We will be adding localization functions to text strings, then creating a .po
file, adding a tag within our theme so that WordPress knows the theme is localized, then optionally converting any translated .po
files to .mo
files, and changing the language setting of our theme. The GNU gettext localization system (also referred to as GetText) is used by WordPress to allow strings of text to be tagged as translatable and then looked up in a dictionary. GetText is available by default on all web servers.
Back up your theme files. In this recipe, we will be updating text seen on the administration side of WordPress and the front-end side, by using the localization functions __()
and _e()
.
Go through all customized files and look for any existing text strings that are already contained within<php ?>
tags. Add two underscores ...