Using POEdit for translating plugin or theme

datePosted on 14:18, August 30th, 2008 by Millan

All plugin and theme authors that added multilanguage support to their plugins and themes, should provide valid POT file with all needed translation strings. This is not required, but it saves a lot of time for the translators.

Translation process needs to produce two files, one with extension MO and the other PO. MO file is the file with actual translation, and the PO is more of a template file that looks like POT but has translation string in it. This PO file is needed if you later need to change and update translation.

There are different tools you can use to translate POT file in PO/MO files, and this post will be about POEdit. This is free and multi platform program that works on Windows, Linux and MacOS. I have noticed that POEdit is not working with plural translations as it should, at least with the ones used by WordPress.

Installation

First you need to downlaod and install the program. Go to http://www.poedit.net/download.php and download version you need. Installation is standard and you are ready to go.

Creating New Translation Project

In File menu you have option ‘Create catalog from POT file’. Dialog will appear and you need to give it POT file you want to translate. Program will ask you for the project info, and here you can add info about project, translation langauge and yourself. After that you need to save catalog. You can use default name for now, we can rename file later. And, now if POT file is valid, you will see the list of translation strings. If the POT file is not valid you will get information about errors.

Translating

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

Important: Don’t translate %s you found embeded in the strings for translation, just leave them. They represent some other value added by the plugin or theme code, usually numbers or something else.

Renaming Translation Files

After you have completed your translation you will have two files with MO and PO extensions. If you leave default names in the begining of the process, these files will be called ‘default’. Renaming file depends on the plugin, but basiclly all plugins shluld follow the same template. Basically name of your translation file should be the same as the POT file with addition of the language code. For example we will use my GD Star Rating plugin.

POT file name is ‘gd-star-rating.pot’. If you have translated plugin into spanish for instance, langauge code for spanish is ‘es_ES’. And translated files should be named:

‘gd-star-rating-es_ES.po’ & ‘gd-star-rating-es_ES.mo’

Simple. Location for those files is another issue. Usually files should be in the same folder as the plugin and POT file, or in separate folder. For GD Star Rating plugin, translations should go in ‘languages’ folder. If you are not sure about your language code check this: http://codex.wordpress.org/WordPress_in_Your_Language.

Updating Translation

It will be wastful to have to translate plugin from scratch with every new version. Once you receive new POT file, you need to open PO file of your translation (‘gd-star-rating-es_ES.po’) in POEdit and use ‘Update from POT file’ option in ‘Catalog’ menu. Point to POT file, and 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.

And that’s it. I hope that this tutorial will help you in translating WordPress plugins and themes.

VN:R_N [1.0.8_355]
Rating: 8.7/10 (6 votes cast)
  • StumbleUpon
  • TwitThis
  • Technorati
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Fleck
  • YahooMyWeb
  • Live
  • Sphinn
  • co.mments
  • LinkedIn
  • MySpace
  • E-mail this story to a friend!
  • Reddit
categoryPosted in Plugins, Themes, Tutorials | printPrint
Related Posts:

Leave a Reply

You must be logged in to post a comment.