Create a .pot or .po File using Poedit
Poedit1 is an extremely popular Gettext2 catalogs editing tool known for its ease of use and fast speed. Numerous WordPress developers and translators are now constantly using this tool to internationalize and localize plugins and themes.
During such internalization and localization processes, a .pot and .po file are created. They are identical in every aspect except for their purposes. A .pot file is often created by the plugin or theme author himself and then delivered along with that plugin or theme so that translators can translate such project using Poedit conveniently. When a translator finishes his job, a .po and a .mo file will be created and will be eventually used by end-users.
Creating a .pot file (for developers)
After you have downloaded Poedit and installed it, fire the application up and then choose File → New Catalog. You’re now at the ‘Project info’ tab. ‘Project name and version’ should be your plugin’s name, ‘Charset’ and ‘Source code charset’ should be ‘utf-8′. Switch to ‘Paths’ tab and choose to add a new item, as described in the screenshot below:

Add a new path
Type in a dot (.) to tell Poedit to search for PHP files in the same folder as the .pot file. Next switch to ‘Keywords’ tab, press the same ‘New item’ button and add all Gettext functions you use for your plugin, most of the time only __ and _e are needed. Make sure all necessary functions are added and press OK. Now press File again and save your file in the same folder as your plugin’s main file (i.e. the PHP file that WordPress will use to load your plugin). By default Poedit saves your file as a .po file but since the two files are identical you can get around that by simply choosing to save the .po file as a .pot file:

Save the .po file as .pot
You can rename the .po file later if you wish. Remember to delete the .mo file created along with our fake .pot file because it is not needed by our translators.
After your .pot file is nicely saved, navigate to Catalog and choose to ‘Update from sources’:

Update .pot file from sources
Just sit back and wait for the process to complete. After you press OK the main screen should be filled with strings that need translating from all of your plugin’s PHP files, excellent! The last thing to do is to save the file again and packed it with your project (remember to again delete the .mo file because each time you save the .pot file another .mo file will be created).
Creating a .po file (for translators)
To create a .po file, simply follow these steps3:
- Download and install Poedit if you haven’t done so already.
- Download/request a .pot file or create one yourself if the plugin or theme doesn’t supply such file.
- Open the .pot file in Poedit.
- (See Image on the right) The box labeled (1) is the original message (in English) from the .pot file. The box labeled (2) is where you add your translation. Boxes labeled (3) and (4) are used for adding comments about the messages. These come in handy if you are working with a team of translators and would like to pass around ideas through the .po file.
- Go to File → Save as… to save your translations in a .po file. If you do not know how to name it, take a look at this page: http://codex.wordpress.org/WordPress_in_Your_Language. The name you should use is the combination of the project’s text domain (locate it inside codes) and a short string in parentheses next to a language’s name (e.g. French – Français (fr_FR)). For example, if the text domain is bwp-minify and the translation is French, just name the .po file
bwp-minify-fr_FR. - When you have finished translating, go to File → Save as… again to generate the .mo file. Or you can set your Poedit to always compile a .mo file when saving changes by clicking File → Preferences and on the Editor tab check the Automatically compile .mo file on save box.
Updating a .po (and .mo) file
Another task of a translator is to update a .po file whenever a particular project has just been updated with more strings to translate, or even obsolete ones. To update your .po file, again navigate to Catalog, but this time choose ‘Update from POT file’, and then choose the .pot file from which you would like to get updated contents. Next, translate the project as you would normally do and save all changes.
Now that you’ve known how to create a .po file, i.e. translate a plugin, please consider translating my WordPress plugins. Finished translations should be sent through the contact fom or through a direct email to contact (at) betterwp (dot) net. Thanks!
References
- http://www.poedit.net/index.php [↩]
- http://www.gnu.org/software/gettext/ [↩]
- http://codex.wordpress.org/Translating_WordPress#Transl ... ith_Poedit [↩]









thank you for the useful post
Thanks. This tutorial saves a lot of time.
hi,
my team just developed a new online software localization tool for getttext po files http://poeditor.com/
it is a free translation utility, of course.
here are some of its features:
-unlimited projects
-unlimited languages
- unlimited terms
- add contributors
- option for open project – everyone can participate
- stats
- import from pot, po, xls, xlsx (for now)
- export to po, mo, json, php array(for now)
- support for context (without plurals for now)
we would be grateful if you could try it out. any feedback is welcome. thank you!
POEditor Team
Awesome post with easy to understand explanations. What are the other tools available for translation?
It’s a shame you don’t have a donate button! I’d without a doubt donate to this superb blog! I suppose for now i’ll settle for bookmarking and adding your RSS feed to my
Google account. I look forward to brand new updates and will talk about this website with
my Facebook group. Talk soon!