0

I'm having a hard time trying to use a custom translation for my child theme based on Storefront (WooCommerce)

For some reason, the translation doesn't take effect.

Here is what I did:

  1. Created a languages directory inside the child's theme folder
  2. Put the corresponding personalyzed es_ES.mo & es_ES.po files (based on storefront.pot)
  3. Edited functions.php to read those files:
function my_child_theme_setup() {
     load_child_theme_textdomain( 'jllorentesstorefront', get_stylesheet_directory() . '/languages' );
}
add_action( 'after_setup_theme', 'my_child_theme_setup' );

But nothing happens, it still uses the default Spanish translations, not mine's...

Any ideas, please? Thanks!

1
  • Are you using any plugin? Commented Mar 9, 2018 at 7:02

1 Answer 1

1

you must have to enque your parent theme first.

function load_parent_stylesheet() {
 wp_enqueue_style( 'parent-styles', get_template_directory_uri() . '/style.css' );
}
add_action( 'wp_enqueue_scripts', 'load_parent_stylesheet' );

Then load your translation folder

function my_theme_lang_setup() {
 $lang = get_stylesheet_directory() . '/languages';
 load_child_theme_textdomain( 'your-domain', $lang );
}
add_action( 'after_setup_theme', 'my_theme_lang_setup' );

Put this in your function.php and try

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.