English is one the most popular languages on the web while WordPress CMS is used by 25% of all websites around the world. However, there are many users who just don’t know English. Therefore, translating WordPress themes into other languages can be profitable both for theme developers who can reach a wider non-English audience and for translators who can offer WordPress theme translation services.
In this article, you will learn how to translate a WordPress theme using Poedit.
Poedit is a software tool available for Windows, Mac OS and Linux that is used for translation of themes and plugins into the required language. You may download this program free from Poedit website.
Poedit also offers a premium version with additional functions like extended support, word count, translation suggestions and more. Currently, pro version costs USD 24.99.
Getting back to our main topic, WordPress theme files contain text strings that need to be translated. Text strings can be found both in admin and user sections of a website.
Example of user section text strings:
- “Search” (search button);
- “Nothing found” (empty search results);
- “Read more” (link to the full post);
Example of admin section text strings:
- “Top primary menu” (Appearance => Menus)
- “Ready to publish your first post?” (welcome page text line)
- “Number of posts to show:” (settings page text line)
Such tools as Poedit (which is free) or plugins like Loco Translate (also free) allow translating text strings from WordPress files. There are also premium solutions for translation of themes, plugin and websites in general, for instance, WPML.
In this article, I will show you how to translate a WordPress theme text strings using Poedit, but before we start, let’s see what files do we need to fulfill translation. In fact, we need to find files with .POT, .PO and .MO extensions.
POT, PO and MO Files
GNU gettext framework is used to translate WordPress themes. This method is applied for translation of WordPress CMS, themes, and plugins. However, you should take into account that not all developers provide translation-ready solutions. Before you purchase a theme, look through a theme description and make sure that it is ready for translation. A major part of free WordPress themes and almost all premium themes can be translated.
Using PO Files to Translate a WordPress Theme
PO is the main file used to create localized versions of themes. POT usually contains a list of all text strings used in theme files. As a rule, it is in the English language.
Developers use special tools, such as gettext, to run PHP source analysis and create POT file containing all text elements to be translated.
POT file created by theme developers is used as a start point for theme localization. Usually, translation-ready themes contain POT, PO and MO files in language folder of a theme. Depending on the theme, POT file can be provided with a number of PO and MO files, and README.TXT instruction for translators.
In some cases, you may find already translated files in your theme. For instance, if you see ru_RU.po file, your theme is already translated into the Russian language. Use this link to find the target language code you need for translation. However, this does not mean that the entire theme is translated (if you use a free theme, probably it was partially translated by previous users or by a theme developer. If this is a case, you will have to check the file for mistakes and omissions in translation before using it).
Human-Readable (PO) and Binary (MO) Files
MO file has exactly the same content as PO file. The only difference is in formatting. While PO file is adapted for humans, MO file contains a compiled data used by computers. WordPress system works with localized themes via MO files.
After the translation is done, the only thing you need to do is to upload or replace relevant files in language folder of your theme on your web server.
How to Translate a WordPress Theme Using Poedit
Step by step instruction on how to translate a WordPress theme using Poedit:
- Download and install Poedit.
- Launch Poedit and click File > New Catalog from POT / PO file.
- Select POT or PO file from language folder of your theme (choose file types to display in the Open File window). Usually, you may find these file here:
- Select target language from a pop-up window.
- Click OK. Now you are ready to translate your theme.
- Save PO file on your computer. If you chose the Russian language like in my case, the file name should be as follows: ru_RU.po.
- The translation process is rather simple. Select text line from the upper section. Type in translation in Translation text box under Source text. Move to the next untranslated line when ready.
- After the translation is done, click Validate button to check errors and then save translation.
- Click File > Compile to MO.
- Upload PO and MO files to language folder of your theme on your web hosting.
Keep all special symbols from source text (see screenshot below) in your translation! Validation function will help you avoid errors related to omission of special symbols.
If you’re a developer/theme user and you need to translate a WordPress theme or plugin from English into Russian, contact me to get a free quote!