Translation with .po does not work with child theme

I’m trying to translate my theme to Dutch by following the steps on this page: https://theme.co/apex/forum/t/setup-translation/61.

Everything works if I upload the .po and .mo file to my main pro theme languague file but it does not work when I upload those files to my child theme.

I have tried this, see image below, but still no success. I do have my Pro-Child theme as active.

Hi there,

Thanks for writing in! We need to check your setup in order to check the issue. Could you please provide us with your WordPress credentials in a secure note.

Thanks!

See secured note.

Hello There,

I could not check the filenames of your translation files. It needs to be:

__x__-de_DE.po
__x__-de_DE.mo
__x__-fr_FR.po
__x__-fr_FR.mo
__x__-es_ES.po
__x__-es_ES.mo

These are just examples of your file names. And still this does not work for you, please upload the files in wp-content/languages/themes/ folder instead.

Hope this helps.

Hi,

I’ve upload it here:

/domains/puppygroep.nl/public_html/testrobbin/wp-content/themes/pro-child/framework/languages

As told before, translation works when I upload .po and .mo files to the non child theme but when uploading it to child theme it does not work.

This is what I added to the functions.php file of child theme:

add_action( 'after_setup_theme', 'load_child_language' );
function load_child_language() {
	load_child_theme_textdomain( '__x__', get_stylesheet_directory() . '/languages' );

}

Hi There,

For some reason I could not log into your site (see secure note).

Also we require your FTP credentials to check your setup as well.

Thanks!

I don’t know why you get that msg. Is it maybe because it’s my developement webiste?

It is just because of the HTTPS.

But you can ignore that msg, right? And just go thourgh the website… I have that sometimes with staging areas.

See ftp details in secured note.

Hi there,

I thought you didn’t upload the language files. Please upload it under /pro-child/languages/ instead of /pro-child/framework/languages/

Or simply if you like, change the code to correctly point it to the folder.

add_action( 'after_setup_theme', 'load_child_language' );
function load_child_language() {
	load_child_theme_textdomain( '__x__', get_stylesheet_directory() . '/framework/languages' );
}

Thanks!

I still can’t get .po .mo file to work… Im getting a bit frustrated here because I’m feeling im wasting a lot of time…

What can I do?

Hi,

I checked your child theme’s functions.php file and the code provided by my colleague was not added.

I went ahead and added that code then test the translations and it works now.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.