WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am adding i18n to the widget on List Category Posts. I've correctly created the pot file, and po and mo files for Spanish and English. All of the Strings are being displayed with _e() on the form file.

The directory structure is as follows:


There are other files, but these are the ones involved in translation. From my Widget class (ListCategoryPostsWidget.php) I'm using this to register the translation:

$translation_dir = '../languages';
load_plugin_textdomain( 'list-category-posts', null, $translation_dir );

And this is the code I'm using to include the form file in ListCategoryPostsWidget.php file:

/** @see WP_Widget::form */
function form($instance) {

Default language is English, so that works fine. But when I set WP_LANG to "es_ES" on my wp-config, I still see the text on the widget in English. Any ideas? EDIT: So, I'm adding some more code:

<p><label for="<?php echo $this->get_field_id('title'); ?>">
<?php _e("Title", 'list-category-posts')?></label>

This is how I'm using the _e function in lcp_widget_form.php.

share|improve this question
Can we see the output code, to help diagnose the problem? – Chip Bennett Oct 28 '11 at 18:20
Sure, which code? The html generated by the widget? That one just shows the Strings in the _e function for eg: _e("Category") displays "Category". – Fernando Briano Oct 28 '11 at 18:29
Yes: the PHP code that generates the HTML output - specifically, the strings that get output. HINT: If you're using _e( "Category" ), you're doing it wrong, and that's why it's not working. – Chip Bennett Oct 28 '11 at 18:31
up vote 2 down vote accepted

Based on your comment:

The html generated by the widget? That one just shows the Strings in the _e function for eg: _e("Category") displays "Category"

I suspect that you've not configured your translation strings properly. You need to include the textdomain in every translation string function call, or else the strings will never get translated.

e.g. for your textdomain 'list-category-posts':

_e( 'Category' )

...should instead be:

_e( 'Category', 'list-category-posts' )

Ensure that all of your translation string functions are declared accordingly.

share|improve this answer
Ooops, sorry I was wrong on the comments, I am using it the way I'm supposed to: _e("Category", 'list-category-posts') – Fernando Briano Oct 28 '11 at 18:38
That's why we need to see the actual code... :) – Chip Bennett Oct 28 '11 at 18:53
I added some more details on the question. – Fernando Briano Oct 28 '11 at 19:04
This is an old question but was just checking my account over here. i18n was finally added: wordpress.org/extend/plugins/list-category-posts/changelog, thanks Chip! :) – Fernando Briano Feb 8 '13 at 5:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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