1

I am experiencing some problems while trying to use my dutch .mo and .po files for my child theme.

I have added the following line to wp-config.php:

define ('WPLANG', 'nl_NL');

After that I have placed the .mo and .po files in: child-theme/languages/. Lastly I followed a post here on stack exchange and pasted this code in my child theme's functions.php:

add_action('after_setup_theme','wpse_110727_translate_theme');
function wpse_110727_translate_theme() {
     load_theme_textdomain( 'textdomain', get_template_directory() . '/languages' );
     $locale = get_locale();
     $locale_file = get_template_directory() . "/languages/$locale.php";

         if ( is_readable( $locale_file ) ) require_once( $locale_file );
 }

After all this, my translation still isn't active on my pages.

1 Answer 1

1

I don't have a TON of experience loading in text-domains, but I think the problem could be as simple as get_template_directory().

get_template_directory() returns the parent directory, while get_stylesheet_directory() returns the child theme directory.

4
  • Hi Eric, I tried it, it didn't work. Thanks for the reply!
    – Matt
    Nov 22, 2013 at 16:54
  • The problem is still there, anyone?
    – Matt
    Nov 24, 2013 at 16:57
  • Give us some more information - echo $locale_file - is it the correct directory? Also why are you trying to being in a $locale.php file? What does that file contain.? Nov 25, 2013 at 13:53
  • having a similar issue. Would love to know if you solved this. Using qTranslate together with the localisation plugin and the Dutch nor German translations load in my child theme at the moment. I added nl_NL to wp-config.php as well and made the needed functions.php changes and created the .mos and .pos.
    – rhand
    Dec 13, 2013 at 10:51

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.