Translation not working after editing plugin template

I’m building a website with WordPress and I’m using the plugin Event Organiser.

I changed the config file of WordPress to use the nl_NL (Dutch) language. This all works fine, even for the plugin, except the pages that use a template I overloaded in my child theme.

Read More

So I made this child theme for twenty eleven, and I copied a template file of the plugin and put it in my child theme and edited it there.

Now only a part is translated to Dutch, the English words/sentences that come after the edited parts (that normally are translated) stay in English.

For instance I see this line in my template:

<?php edit_post_link( __( 'Edit'), '<span class="edit-link">', '</span>' ); ?> 

or this line:

$utility_text = __( 'This event was posted by <a href="%5$s">%4$s</a>.', 'eventorganiser' ); 

which then gets printed with printf. I did not add these lines, they were already in the template, and did work when the template was unaltered.

What can I do to fix this? Even the edit button, which translate to dutch on other pages, doesn’t translate.

A one line solution would be great.. But that won’t be the case sadly 😀

Related posts

Leave a Reply

2 comments

  1. You could try to run poedit on the plugin to see if there are untranslated strings, but it seems related to the use of child-theme template file.

    Maybe a quick fix could be to copy the lang files into your child theme folder too and see if it works (you will probably need to change de text_domain for each strings and generate a new lang file for your needs).

    I’m not very familiar with child themes and plugin template files, sorry.

  2. Check the plugin translation files. If they aren’t there or are not complete, then there won’t happen a translation.

    When you see a textdomain, then this string belongs to this textdomain. If you see none, then it’s the global WordPress core translation file.

    So __('Edit'); will be translated by core and __( 'This event was posted by <a href="%5$s">%4$s</a>.', 'eventorganiser' ); by @StephenHarris “Event Organiser” plugin. If the plugin has a translation file for nl_NL, then it might have this string translated. But at the end this depends on the translator (a living person). You can anytime jump in and add/edit such files and send them to the author.