Wordpress : Translate a Plugin

Wed, Jun 25, 2008

PHP, WordPress, Wordpress Plugins

First off, you have to know that not all Wordpress plugins can be translated. The plugin developer(s) had to take the necessary steps such as using the Wordpress __() and _e() functions and load_plugin_textdomain() in order to parse the strings/text of the plugin through the localization system.

If you have a plugin with the ability of being translated, this tutorial will guide you through the steps of translating the plugin using an application called poEdit with screenshots taken on the Macintosh operating system. poEdit is available for Windows and Linux users as well though.

Before we get started, you’ll need to obtain poEdit from the poEdit website. It is a free and has been released under an MIT license, which allows you to download, edit and redistribute the source code as long as the original license information is kept intact.

I am going to translate the Wordpress Mailing List plugin. I have my plugin folder ready for use, placed on my desktop where it is easily accessible. I will now open poEdit and go to “File” > “New Catalog…” to create a new catalog file for this plugin.

The moment I click “New Catalog…”, the application displays a dialog window with three (3) tabs at the top. The first tab is called “Project Info”. The only mandatory field is the “Project Name”, though you can fill all of them in if you want to.

The second tab is called “Paths” and gives you the ability to specify the base path and other paths to the PHP files which need to be translated. In this tutorial, I’m going to place the catalog file directly into the plugin folder, so I’m using a dot “.” for the “Base Path” field and I create a new path item and fill in a dot “.” as well. See the screenshot below.

The third and last tab is called “Keywords”. It has a blank, white area and some buttons to the top-right. The second button from the left allows you to create new keyword items. Create two keyword items. The first one is a double underscore “__” and the second item is underscore and the letter E (in lowercase) “_e”.

When you are done with this, simply click “Ok”. The poEdit application will now open a new dialog prompting where you would like to save the .PO file. Navigate to the plugin folder, type in the desired name for the catalog file and save it inside of the plugin folder.

Save the catalog file by hitting the “Save” button. Next up, the poEdit application will immediately start a scan which will scan through each and every one of the PHP files inside the directory based on the details you filled in the “Paths” section in the “Project Info” dialog before. When it is done scanning, it will display all the translatable strings/text and show you how many there are as well.

Now click “Ok” and you can start translating the available strings. For each string you click on, the application will display the original text in a box and provide you with another text area where you can type the translation.

With all the strings translated according to your preference, save the catalog file inside of the plugin folder and upload it together with the rest of the plugin files to your Wordpress installation. Wordpress should automatically load the language file when the plugin is loaded and in case it does not do that, you might need to open up your “wp-config.php” file and set the WPLANG constant to the appropriate language.

All the best of luck!

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • E-mail this story to a friend!
  • LinkedIn
  • Live
  • Ping.fm
  • StumbleUpon
  • Print this article!
  • Reddit
  • TwitThis
, , , , , ,
scriptlancebannerpng

This post was written by:

Antonie Potgieter - who has written 52 posts on Lost-In-Code.

I (Antonie Potgieter) am a software engineer/web developer located in South Africa. My full-time work is the management of Tribulant Software and the development of its software packages.

Contact the author

24 Comments For This Post

  1. _asterix_ Says:

    Thank you for that good tutorial!

  2. poker español Says:

    Found this site by another article, but this post will help me a lot, and i want to thank you, sounds easy to follow instructions, hope dont have any problems to make it work, i will test it under ubuntu 7.10, whe its done back to post the results.

    Thank you.

  3. ecommerce web hosting Says:

    I really liked ur guidance. Thanks for the help

  4. ecommerce software Says:

    great find on poedit and great post with easy to follow directions, thanks. let me try this method on some of my sites.

  5. ecommerce adviser Says:

    this is quite easy to follow, I think I might try to build upon it a little in my next post

  6. program,sağlık Says:

    thanks very useful article.

  7. DoFollow Blog Says:

    Indeed a useful tutorial,i’ve needed to translate some plugins few days ago but i didn’t found any good software.

  8. Steven @ Best Online Casinos Says:

    I’m not sure whether to go with drupal or to stick with wordpress?

    The plugins for both platforms seem to both be pretty good.

  9. Antonie Potgieter Says:

    I definitely recommend & suggest WordPress rather than Drupal. I could give you several valid and reasonable reasons.

  10. Free classifieds posting weekly Says:

    this is quite easy to follow, I think I might try to build upon it a little in my next post

  11. Jimmy Says:

    I would say wordpress too, I think that from a future proof perspective you are safer and the community around it seems more helpful

  12. Ecommerce Says:

    Thanks for the help on ecommerce and the plugin tutorial.

    Internet Marketing Alternatives

  13. program Says:

    thank you for this post.this article is very useful finally, this site is very good.

  14. dani Says:

    great find on poedit and great post with easy to follow directions, thanks. let me try this method on some of my sites.

  15. Scrap car Says:

    Yes wordpress i wouldd say is better than drupal, but i think it down to preference really.

  16. Mike Says:

    Gotta Love WordPress!!!
    Thanks For The Great Tutorial!

  17. CheapDVDs Says:

    Thanks a lot for this very helpful tutorial. I was not familiar with poEdit, but it really looks like a very handy piece of software.

  18. Hospedagem Says:

    Thanks let me try this method on some of my sites.

  19. Rasmus Says:

    Excellent walk trough of how to handle translation proces in poedit. very helpful.

  20. adobe partner Says:

    Thank you for that tutorial!
    Nikita Narvov INC.

  21. indir Says:

    thanks for super tutorial

  22. Roofers Croydon Says:

    I would say wordpress is netter than dupal, but again it is really down to preference.

    Ewan

  23. affordable websites Says:

    I really needed this walk-through for this plugin. I was completely lost great article.

  24. Medical Job Australia Says:

    This was very helpful, I must try this method soon.

1 Trackbacks For This Post

  1. blogbookmark.com Says:

    How to translate a Wordpress plugin…

    This article/tutorial will guide you through the process of translating a compatible Wordpress plugin into any language of your choice….

Leave a Reply