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!

, , , , , ,
domain-whois-widejpg

This post was written by:

- who has written 73 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

48 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.

  25. yuNus Says:

    Best WP.
    Thanks.

  26. IRRIFYSMUBS Says:

    Am I going to complain about being typecast as smart? I don’t think so.

  27. office supplies Says:

    This article is a really useful tutorial. Thankyou so much for the valuable information i love learning what wordpress can do.

  28. Application Performance Management Says:

    Fantastic tutorial. I never knew you could translate a plugin. I have a couple I need to work on. Thank you for the great article.

  29. Locksmiths Westerham Says:

    What a very helpful tutorial, I have learnt a lot about wordpress lately and found your site to be very helpful indeed.

  30. Ashley Says:

    I feel we can always request for a translation at the plugins page so that the developer translates and give us the plugin. Isn’t it?

  31. hypercasinos Says:

    Thanks! finally we can translate some plugins with your help. great work!

  32. Automattic Says:

    I think WordPress is better than Drupal. The sheer number of WordPress plugins and templates available make it such a great CMS platform to work with. This tutorial is very helpful by the way, thanks for the walk-through.

  33. Driving School Bromley Says:

    WordPress is great, dupal is also great too.

  34. Gambling Says:

    Good plugin. Have a site translated into several languages is very important to access large amounts of visitors and potential customers.

  35. Driving School Bromley Says:

    Drupal I have know got used to and it is soooo much better.

  36. Driving School Bromley Says:

    WordPress is very easy to work with I think it is the best to be honest

  37. Camila Perry Says:

    For me, the best operating system is Linux because it rarely hangs..~*

  38. Natascha Says:

    Thanks for this great post, I was looking for something like this before but as I found your article, I was able to translate a personalized plugin in seconds ;)
    Thanks again, you did a great job!

  39. Shan Mcduffey Says:

    Extremely good post and actually aids with becoming familiar with the subject much better.

  40. Kitchen Units  Says:

    the best operating system is always Linux, after Linux it is Windows XP. Vista sucks–’

  41. Kerala Girls Says:

    there are many different operating systems but of course i would still prefer to use linux for stability ~*”

  42. Btranslation Says:

    WOW! a little hard for me but I guess, I’ll be able to do it once I re-read the instructions you gave… In other words, I’m LOST IN CODE .. LOL
    Anyways thanks!

  43. rudolf Says:

    Yes, great tuts, but i still don’t get the thing with the PATH.
    Anything i try gets me 3 lines of errors upon saving the initial .po file right into the plugin or theme main folder, using nothing but . as you suggest here for both paths.
    The errors are:
    PoEdit can’t find any files in the folder
    Catalog entries maybe invalid (haha)
    The third one is actually just a repeat of the error message without viewing the details, (kind of semi-good this program…)
    saying Actualization failed – what the crikey is wrong??

    P.S. your social networks buttons are at a dumb place for posting comments!

  44. rudolf Says:

    ok, i let you all know how this stuff with the paths actually works!

    Inside Base Path goes an actual full path like
    C:\mydrive\mywebsitefolder\mywordpresspluginortheme
    Inside the New Path goes only a dot!
    .
    That works, what a drag through endless Google searches where nobody could point this out in plain and simple terms!

    But, still one more trouble – it seems that this only fetches the PHP files inside this folder, what if there is another folder that contains additional PHP files that need translations, how do i add those to the ones from the main folder please??

  45. marek Says:

    Hello, I want to use this tutorial and translate my facebook like button, but I am missing a fisrt point.How Poedit will recognize that I am willing to translate facebook button? Sorry for such a question but I use WB for a week. Can you provide me hint of this pls?

  46. janko hrasko Says:

    Hello.I want to translate facebook button and would like to ask how Poedit will recognize that I want to translate it…sorry for such a question I am in WP for 1 week.
    Could you provide me with a hint?

  47. Chris M. Says:

    Hey thanks for the easy tutorial. This is just the solution I need but I’m having trouble getting the plugin to actually display the translated words. I’m using MarketPress on my MAMP server on my home machine for a development project and it’s not happening for me. Any insight would be appreciated.

    Thanks!

  48. Fabiano Shark Says:

    Thank you, help a lot!

2 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….

  2. Wordpress : Translate a Plugin | Lost-In-Code - dhansson - dhansson Says:

    [...] WordPress : Translate a Plugin | Lost-In-Code Relaterade inlägg :D eprecated Plugin — Find Old Rails Code | Ruby on Rails for NewbiesXili-language Plugin | WordPress PluginsWordPress plugin and widget tutorialWPML Multilingual CMS Plugin | WordPress PluginsCreate a Custom WordPress Plugin From Scratch | Nettuts+By Blogsdna [...]

Leave a Reply