I'm building a plug-in which is going great so far. I want to start making it localization ready. I don't know what is going wrong, but it's bugging out on me when I try to load it in Poedit.

So let's do this step by step as multiple tutorials show me to.

So in myplugin.php I load the following to tell WP where my language files are (after actually creating the folder).

function ap_action_init()
// Localization
  load_plugin_textdomain( 'myplugin', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); 

add_action('init', 'ap_action_init');

Then I adjust all strings that need translation in my file (which is in the admin folder).

<h2><?php _e('MyPlugin Settings', 'myplugin'); ?></h2>
<?php _e('Element Width', 'myplugin'); ?>
<?php _e('This defines the default width of your Elements', 'myplugin'); ?>

So far so good, I would think. But then I open Poedit.

I tell poedit to save the myplugin-nl_NL.po in the languages folder in my plugin.

I tell the base path to be ../

And I tell my paths to be either ./admin or admin (if I give it /admin, or something else, it gives me an error the folder doesn't exist. So I'm assuming it finds my folders).

I tell poedit to look for the keywords __() and _e().

And then I press ok! Every single time (whatever I seem to try) It doesn't show me any strings to translate, where as I import a normal .po it does show me alot.

So. Is anyone seeing where it's going wrong here?

P.S: Maybe an important notice. If I try to manually create my own .po file, it does show me strings in POedit. But if I put this on my website and change WordPress it's language it doesn't change anything. So my guess is I'm doing something wrong in my WP files.

Hope anyone can help :)

  • 1
    I noticed that you didn't mention the .mo file. Did you include it as well?
    – birgire
    Commented Aug 12, 2014 at 0:24
  • Fixes the problem for the .po I created manually :) Not for my poedit nog recognizing my files though. Commented Aug 12, 2014 at 0:28
  • 1
    This post might help Commented Aug 12, 2014 at 8:57
  • Yeah it did. Although a lot of things where different :) Commented Aug 12, 2014 at 17:51

2 Answers 2


Ok. I Found the problem. Several tutorials told me to put __() and _e() in my poedit. Which, now I've found the answer is pretty stupid. Because there simply don't exist any strings with these search values. As there is always something in between those brackets.

Solution is thus very simple (and quite stupid). Put the search values to __ and _e


Instead of using poedit to generate your translation strings from your code, use the WordPress i18n tools to generate a POT file for you.

This has the advantages of a) not needing you to do anything special in poedit and b) getting everything that is possible for translation, including headers and non-standard translation string calls (not everything is __ and _e).

To do this is relatively simple, really.

Step the First

Get an SVN client, and do this:

svn checkout http://develop.svn.wordpress.org/trunk/ develop

This will get you a copy of the WordPress trunk directory, and the special tools developers need with it. You may not need all of these tools, but there is one that you do need.

(Note: If you are a git user, you can make a clone of git://develop.git.wordpress.org/ instead.)

Step the Second

Go into that directory, then in the tools directory, then in the i18n directory. Here you will find a file called makepot.php. This is the one you need.

To use it is very simple. Get a command prompt and type this:

php makepot.php wp-plugin /path/to/your/plugin/folder plugin-slug.pot

The "wp-plugin" flag is telling the code to examine a plugin. You can also use wp-theme here to generate a POT file for a theme.

Replace the path to your plugin's folder with the relevant local copy of the plugin, and use your own plugin's slug for the pot file name. The PHP code will scan your plugin's directory and build a POT file for you.

A POT file is a "PO Template", which poedit can handle quite nicely, I believe. You may want to edit its header (in any text editor) to have your author and plugin info in it and such.

Why this is better:

Compare the results yourself. Note that the headers of the plugin are included in the POT file too. If you used any special translation methods like _x or _ex or _n_noop, then those will be in the file as well.

Note that the makepot.php code is not standalone, it requires that WordPress's source code be available. So you need the whole checkout, not just the tools directory. It uses the WordPress translation code to do some of the work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.