Translate WordPress Themes & Plugins using Poedit (Free Version)
Striving that how would you go about translating the WordPress theme or plugin? Is localization of a WordPress theme/plugin seems ‘a hard nut to crack’ to you? No more worries. From now onwards…it will be a kid’s play for you !!
In today’s world, Business is all about accessibility. If we talk about Internet world then it’s all about developing a searchable and easily accessible website. As you develop a WordPress website that may have viewers from non-native English speaking countries. So, it can be necessary to translate the theme/plugin allowing clients to manage their websites in their native languages. But it will not be a daunting task rather a matter of few easy clicks. Before starting with translation process, let us know the basics involved in this.
- Translation-Ready theme/plugins:
When a theme is provided with i18n features, it’s called translation-ready. Where i18n is the abbreviation for Internationalization and named so because it takes 18 letters between i and n. It adds features to themes that make later translation possible in form of a POT file.
POT – It stands for Portable Object Template. You will get this file when you extract texts from the application. Normally, this file sends to the translators.
- Localization of theme/plugin:
It is abbreviated as l10n. Both the i18n & l10n are like two sides of the same coin. Localization is the process of translating a theme/plugin to a foreign language. Basically, it includes the extraction of .pot files and then translating and uploading them with a theme in form of PO and MO files.
PO – A Portable Object. This file is received back from the translators. It’s a text file including both the original texts and the translations. MO – The Machine Object (MO) file includes the exact same contents as PO file. The two files differ in the format. A PO file is a text file whereas MO files are compiled and are easy for computers to read. Web servers use the MO file to display the translations.
MO – The Machine Object (MO) file includes the exact same contents as PO file. The two files differ in the format. A PO file is a text file whereas MO files are compiled and are easy for computers to read. Web servers use the MO file to display the translations.
- Translation Software:
Poedit is an editing software to translate any WordPress theme or plugin that is localization-ready. It is the most dedicated editor known for the best results. You can easily download and install it from its official site.
Eazy Po is an application to translate your WordPress theme and also manage your projects and keep track of translation status of each file. It is portable too. You can easily download it.
Let us delve into the process of translating a WordPress theme/plugin into a required foreign language by means of this two software as follows.
1. Creating PO & MO files with Poedit:
Poedit is a popular tool for translating a WordPress theme/plugin with advanced features. But when a user starts translating from the main screen choosing Translate WordPress theme or plugin, probably will feel stuck as can’t move further without upgrading to Pro version of Poedit.
This message will hinder you.
But, here is one proposed solution. Let us see the steps to create translation files (.po & .mo) directly bypassing the .pot file generation module. For this, we will make use of Poedit only as follows:
- From top menu of Poedit, Go to File –> New…
It will open a Translation Language dialog. From here, choose the required translation foreign language.
- Navigate to File –> Save and save the file somewhere.
- Come to the Main Window again and choose “Extract From Sources” option here.
- It will lead you to the Catalog Properties window.
In Source Paths, Click the small “+” button under “Paths” (bottom left corner) and select the main folder of your theme/plugin.
- Now move to “Sources Keywords” tab along the top and click the small add button and enter __ (that’s two underscores) then press enter.
- Click on the small Add button again to add more translation functions.
Here is the list of all the functions _e(), _n(), _x(), _ex(), _nx(), esc_attr__(), esc_attr_e(), esc_attr_x(), esc_html__(), esc_html_e(), esc_html_x(), _n_noop(), _nx_noop(), translate_nooped_plural(). So that all the strings could be extracted inhibiting these functions. You will get the final screen to choose your preferred translations on Poedit screen as shown below.
You will get the final screen to choose your preferred translations on Poedit screen as shown below.
- Finally, go to File → Save. Now you can see the newly created .po and .mo files in Languages folder of your main Theme/plugin file.
2. With Eazypo:
Once you are sure about having a translation-ready theme/plugin, can move further to translate/localize it with help of Eazy PO software. The translation procedure is as follows:
- Create POT file:
It will extract all the .pot files associated with theme/plugin. So in order to produce a .pot file for a WordPress theme/plugin, you can follow steps as explained below:
Select “Extract messages from source code” option from the main screen of Eazypo.
It will open a Command Manager as shown below. Navigate to Source Files here.
Now specify the source input folder of theme/plugin you want to translate by browsing it.
Source Input folder → Browse folder.
From the left pane of Eazypo, move to Build and Click Execute Command.
Build → Execute Command
It will serve your purpose of creating a .pot file and the final screen you see will look like as below. Just close this application now.
You can simply add the translation strings in the Targeted text area and then Create PO & MO files from Catalog option and save them.
Catalog → Create Po File → Save
Catalog → Create Mo File → Save
You are done. But if you want to create more translations in different languages, you can follow the steps given below:
- Create New PO file from existing POT file:
Once you have a .pot file, you will create a .po file. For that, go to File → New from file..
A New Catalog dialog will open as shown below.
Select source type as pot file. Now Browse your file here & move Next.
When you click Next, a New Catalog will open. From here, select the target file as Po and navigate to Language: selection option.
A Language List will display to choose from. Make your selection for language and click the Select and Close button.
Now the main screen we get will look like:
Here, you will add the translation in the Green highlighted area known as Target Text area.
- Create Mo file:
Finally, you can create the Mo file from the top menu of the screen by selecting:
Catalog → Create Mo file…
Here specify the desired name and location for the Mo file. Generally, we save in Language folder of the theme/plugin is being translated.
You are done !!
Setting Up the Translated Theme/Plugin in WordPress
The default language in WordPress is ‘English’. So you have to specify your language forcing WordPress to recognize it. For this, you have to write a little code into the wp_config.php file as follows:
define (‘WPLANG’, ‘de_DE’);
This line will tell WordPress to use German(Deutsch) of German. Similarly, you have to give Language plus country code here to specify different foreign language. For this, you can refer this link to find wp locale and can easily use any language for translation. Simply, replace ‘de_DE’ with wp locale of language and country you want.
To summarize, we make use of two applications to translate/localize a WordPress theme or plugin. Firstly, we give a solution to create Po & Mo files with Poedit freeware. Then, we repeat the same process with Eazypo. These are handy solutions to utilize two freeware to create essential .po and .mo files of a WordPress theme/plugin smoothly and painlessly.