How can I edit PO translation files?

Updated: March 25, 2014, 12:09 pm

In our themes you can find POT (Portable Object Template) file for translations in theme folder: ./languages

For example for Directory theme it is ./languages/directory.pot file.

For translation are necessary also files *.po and *.mo which names depends on your Language Code and Country Code.
Structure of files names is: LanguageCode_CountryCode.po
The name of files must be the same like WPLANG parameter defined in WordPress config file wp-config.php.
Click here for more information about WPLANG parameter…

i.e. for German translation these files will be named de_DE.po and de_DE.mo

So for translation you need to have finally three files (files below are as example for German translation):

  • directory.pot
  • de_DE.po
  • de_DE.mo

You need to create *.po and *.mo files yourself.
To create these files you can use Poedit tool.

poedit

After installation, go to preferences of Poedit via menu File > Preferences and in Editor tab of options select “Automatically compile .mo file on save” to automatically create mo file during saving po file.

poedit_auto_compile_mo

After this, you can start translation and create *.po and *.mo files.

1. start with click on the button Create new translation:

poedit_create_translation

2. window to select POT file appears, navigate to .pot file of theme inside ./languages folder and click to open.

3. after opening POT file Translation Language selection appears, choose your language:

poedit_select_lang

4. you can start translate words included in POT file to your language:

poedit_how_to_translate

5. if you’re done with translation click Save to save po and mo file. Don’t forget to write the same name of file like the WPLANG parameter defined in wp-config.php

poedit_save

After this you would have in theme ./languages folder three files.
1. pot file
2. po file
3. mo file