Translating a WordPress theme
This is a short tutorial on how to properly translate a WordPress theme. Mystique is used as example here. I will choose PoEdit as the translation application, since it’s the easiest to use because of the simple user interface.
…so, here are all the steps:
First download and install Poedit.
Select the theme you wish to translate and extract or copy the theme files into a new directory. In this example, I’m unzipping all the theme files inside the C:\mystique directory. Now open the PoEdit application, and create a new catalog (File > New catalog), or you can open an existing catalog from the theme directory, if the theme has one. For example, the en_US.po file for Mystique.
From the menu, select Catalog > settings and fill all the required information.
Don’t close the settings window yet. Click on the Paths tab and change the local path from 1st line with your path to the theme files, in our example C:\mystique
Click OK, then update the catalog (Catalog > Update from sources) to verify that your path to the theme is correct, and to update all the strings. You can also update the catalog from a existing .pot template, if the theme has one (that way you wouldn’t need to extract all the theme files on your computer).
If you don’t get any errors, you can start translating the theme by selecting each string in bold from the list, and typing the translation in editable area from the bottom. Here’s a sample phrase translated to French:
Be careful with the php values, such as %s, %2$s etc. Always include them in the translated string! If you want to hide some of them you can use html comments – for example if you want to hide the author link in Mystique (original string: Posted by %1$s in %2$s):
Posté <!-- par %1$s --> dans %2$s
When you’re finished, save your catalog by using the languagecode_COUNTRYCODE file naming convention, eg. as fr_FR, and upload the compiled catalog that was generated by PoEdit (eg. fr_FR.mo) to your server, in the appropriate theme language file directory. That’s it
Related resources:
WordPress in Your Language
Belorussian translation of this article (by Patricia Clausnitzer)