Translations are not working

Hi I deleted the translation from /public_html/wp-content/languages/themes/ and I copied the translations to the following directory /public_html/staging/wp-content/themes/pro-child/lang and added the following code to the child functions.php and didn´t work.

load_child_theme_textdomain( ‘x’, get_stylesheet_directory() . ‘/lang’ );

Note: this is a staging site you can change whatever you need to make it work.

Hi there,

No, you don’t just add that in your child theme’s functions.php, check the above code. You have to change that specific line with the new line that I provided.

Like this

add_action( 'after_setup_theme', 'load_child_language' );
function load_child_language() {
	load_child_theme_textdomain( '__x__', get_stylesheet_directory_uri() . '/lang' );
}

As additional note, you’ll only use this naming

__x__-es_ES.mo __x__-es_ES.po

IF, you added your theme translation under public_html/staging/wp-content/languages/themes/

ELSE, IF you added it in your child theme, then it should be just like this

es_ES.mo es_ES.po

I went ahead and applied all those changes, it’s now working

Thanks.

yes now it is working as I needed thank you.

You’re most welcome!