I'm trying to translate a child theme of a parent theme that has all msgstr empty.

Therefore, I've created the file de_DE.mo using the "WordPress i18n tools" recommended in the docs together with msgfmt. I put the file into my child theme directory's subfolder languages/child.

To tell Wordpress about it, I added this to my functions.php where mo_theme is the parent theme's translation domain:

add_action( 'after_setup_theme', function () {
    load_theme_textdomain( 'mo_theme', get_stylesheet_directory() . '/languages/child' );
} );

However, the translation I've defined is not used. The .mo file looks OK, and other things defined in my functions.php have an effect.

I have used gettext in other contexts, but not yet together with Wordpress. Is there anything special I should care about?


My parent theme defines __('View your shopping cart', 'mo_theme').

In the .po file I've created, this is translated like this:

#: woocommerce/woocommerce-integration.php:76
msgid "View your shopping cart"
msgstr "Zum Warenkorb"
  • 1
    Stupid question, but it's the only step you've not mentioned and everything else look fine. Have you defined the WP_LANG constant...? Commented Mar 21, 2016 at 11:19
  • 1
    How are your gettext strings witin PHP? Can you show us some examples?
    – cybmeta
    Commented Mar 21, 2016 at 11:39
  • @StephenHarris Hehe. Your question wasn't too stupid. Now I define('WPLANG', 'de_DE'); in my wp-config.php. However, this still does not help. Commented Mar 21, 2016 at 15:11
  • @cybmeta Thank you for asking back! I've added an example. Commented Mar 21, 2016 at 15:17

1 Answer 1


Your code use load_theme_textdomain. If you are in child theme and need to load translated strings, use function load_child_theme_textdomain. Please take a look this answer too Override parent theme translation on child theme.

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.