Translating plugins or themes using POEdit

All Dev4Press plugins and theme have multi-language support. To create a new translation, best program available is POEdit, a free program that will help you create valid translation files. This program will help you create the translation, and later update it when the new version is released.

The plugin has a Pro version also, and this version has improved support for WordPress and very useful auto-translate feature, but if you already have PO/POT template files or you don’t want to use auto translation, you don’t need the pro version.

Before we start

For translations to work, for WordPress to load any available translation, it has to be set to the proper language. If you leave WordPress in English, it will not load any translations (most plugins and themes are in English already, as is WordPress). If you set WordPress to your own language, WordPress will load translations that match that language.

POEdit Start Page
POEdit Start Page

Translation Process

Installing the POEdit

You need to download the latest version of the program from http://www.poedit.net/. Installation is simple much like any other program. There are versions for Windows, Linux, and Mac OS so you can work on any platform with it.

Creating new project

All Dev4Press plugin include POT file (template for the translation) with all the strings in the current plugin or theme version. For this example, I will use GD bbPress Toolbox Pro. POT file is: gd-bbpress-toolbox.pot and is in the main plugin folder.

In File menu, you have option ‘New from PO/POT file’ or from the main plugin screen ‘Create New Translation’. A dialog will appear and you need to give it POT file you want to translate. So, click the ‘Create new translation’ button, and POEdit will ask for a file, select gd-bbpress-toolbox.pot from your computer.

Select default language
Select default language

You will get the question about the default language, select English. You now need to set which language you want to translate into. From the main menu, open Catalog and then Properties.

Set project name (best to use plugin name) and select language you want to translate to. For this example, I have selected Serbian. It is important to select Plural form version (best to leave it to default for the language). Enter your email and name.

When you finish, the dialog will look like this:

Now, save the file to the hard drive. My recommendation is to use the name of the plugin and the code for the language. So, for Serbian, this file name would be gd-bbpress-toolbox-sr_RS.po. sr_RS is code for Serbian, and to see the list of all language codes, check out the list on WordPress website.

Project Dialog
Project Dialog

Keep the .po file safe, you will use it later to update the translation, and it holds all the translated strings. When continue to edit, you need to open that file, not start again with POT file.

Translating

This is pretty obvious, you need to translate all strings. Below the list, you will see two two fields, one with original string, and the other for your translated string. Right click on any string in the list, will show you comments for that string, and usually, that is the location of the string in the original files, in our case plugin or theme. You can also copy the value of original string into translated string.

The image below shows how the translation works. Suggestions on the right will work with Pro version only.

Translation Example
Translation Example

Important: Don’t translate %s or similar string you found embedded in the strings for translation, don’t translate HTML tags, just leave them. They represent some other value added by the plugin or theme code.

Finalizing translation

Once you complete translation, you need to export the translation into MO file. MO file is actually used by WordPress. To make MO file, from the menu File select option ‘Compile to MO…’. If you named PO file properly, MO file will have the same name (different extension), so for this plugin, you will get gd-bbpress-toolbox-sr_RS.mo file.

This file must be added into plugins languages folder. All Dev4Press plugins have languages folder in the plugin own folder (in WordPress wp-content/plugins folder).

Translating plural forms

Before you start translating, you need to set plural forms. Best to leave to default, or if you know the logical equation for your language, enter it into the field. Once you set plural form, when you get to translate the plural word, main POEdit form will look a bit different, showing two or more translation fields depending on the number of plural forms.

Updating the translation

When the plugin POT files are updated, you need to update your translation files. Once you receive new POT file, you need to open PO file of your translation (‘gd-bbpress-toolbox-sr_RS.po’) in POEdit and use ‘Update from POT file’ option in ‘Catalog’ menu. Point to POT file and the program will show you what is new and will add this new strings for you to translate. Also, will show you what is became obsolete, and will remove old and no more needed strings from your translation. The program will try to recognize the changes and offer you the ‘fuzzy’ translation.

FAQ

Here are the few more translation related questions and answers.

Can I translate addon to my language?

Yes. POT file is provided as a base for translation in the root folder for each plugin. Translation files should go into languages directory, and WordPress must be set to your language to load the file. The file name for translated and compiled MO file must be the same as POT file with the addition of language code: {addon-name}-{language-code}.mo.

You can check out this for translating plugins using POEdit program:
wp.dev4press.com/tutorials/translating-plugins-or-themes-using-poedit

Rate this FAQ answer

You must be logged in to rate this.

4
0
20598

Can I translate plugin to my language?

Yes. POT file is provided as a base for translation in the root folder for each plugin. Translation files should go into languages directory, and WordPress must be set to your language to load the file. File name for translated and compiled MO file must be the same as POT file with addition of language code: {plugin-name}-{language-code}.mo.

You can check out this for translating plugins using POEdit program:
wp.dev4press.com/tutorials/translating-plugins-or-themes-using-poedit

Rate this FAQ answer

You must be logged in to rate this.

4
0
23973
Rate this article

You must be logged in to rate this.

0
0
78

Comments

Leave a Reply