Extra translations in Storefront child theme not loading/working
-
I’m using WC with the Storefront theme and have created and activated a child theme. As per the instructions in wp-content/themes/storefront/languages/README.md I created de_DE.po and de_DE.mo in the languages subdirectory inside my child theme’s folder. The de_DE.po contains a single translation:
#: woocommerce/myaccount/dashboard.php:59 msgid "Your purchased content" msgstr "Deine gekauften Inhalte"
I’ve duplicated the file wp-content/plugins/woocommerce/templates/myaccount/dashboard.php as per the instructions in that file in the subfolder woocommerce/myaccount inside my child theme. In that file I’ve added the following code to display the translated text:
<h3><?php printf(__('Your purchased content', 'storefront')); ?></h2>
However, the translation isn’t showing, instead it’s just showing the original string. All other strings are showing up in German, the locale is set to de_DE.
As I understand it, the code in wp-content/themes/storefront/inc/class-storefront.php already loads any child theme translations/textdomains with this code:
load_theme_textdomain( 'storefront', get_stylesheet_directory() . '/languages' );
So I assumed I don’t have to manually add anything to my child theme’s functions.php. Nevertheless, I also tried loading the textdomain manually using
load_child_theme_textdomain( 'storefront', get_stylesheet_directory() . '/languages' );
, but that didn’t change anything.I’ve also tried out different textdomains, e. g. the name of my child theme and “woocommerce”, which also did not work.
I’m at a loss what I’m doing wrong here. Any ideas?
- The topic ‘Extra translations in Storefront child theme not loading/working’ is closed to new replies.