Theme Translation not working for Post Meta and Social Sharing

Hey there,

I just bought the Poedit full version, so that I could enter more than 10 translation items.

However I am still experiencing the same issues as before, even though I followed the instructions on your new translation post step by step.

The “Leave A Comment” section in the Post meta and the social sharing hover text “Share on Facebook” etc. are not translatable. The other translations work fine.

Please help.

Kind regards,

Gino Lazzaro

Hey Gino,

I checked and those strings are translatable. Please ensure you’re using the latest version of X and give us access to your WordPress admin and FTP in a Secure Note so we could check what’s wrong.

Thanks.

Hey Christian,

thank you for your reply. I added a secure note.

Regards,

Gino Lazzaro

Hi there,

The correct language file names are __x__-de_DE.po and __x__-de_DE.mo once you placed them in child theme. I changed the name, but, your translation is incorrect

In your PO file, it shouldn’t be <span>Leave a Comment</span> and <span>Schreib’ ein Kommentar</span>. There is no <span> in post meta. It should be just Leave a Comment and Schreib’ ein Kommentar. Please change them accordingly.

Thanks!

Hi Rad,

I changed everything accordingly. Nothing changed.

I cannot edit the source Leave a Comment only the translation. I changed the translation.

Regards,

Gino Lazzaro

Hey Gino,

I have investigated the issue and I can confirm that the keyword is nowhere to be found in the translation file. I was able to resolve the issue by adding this code in your child theme’s functions.php file

add_filter('gettext', 'translate_my_text' );
function translate_my_text($translated) { 
     $translated = str_ireplace('Leave a comment on: &ldquo;%s&rdquo;', 'Schreibe ein Kommentar zu: &ldquo;%s&rdquo;', $translated);
     $translated = str_ireplace('Leave a Comment', 'Schreibe ein Kommentar', $translated);
     return $translated; 
}

You can add more keyword by just replicating the line in the code just like what I did.

Please let us know how it goes.

Hey there,

I can see that this worked. However the Social Sharing Element below the post still isn’t translated.

Regards,

Gino Lazzaro

Hey Gino,

I commented out the code provided previously by @RueNel and your translation still works. Share on Facebook works also.

The Share on Facebook string in X is for the portfolio. The Entry Share string you’re using below each post is powered by Cornerstone and it’s text domain is different. It is not __x__ but cornerstone. With that said, you need to translate Cornerstone too. If you want to manually do it, please follow this guide. Otherwise, you can use a translation plugin like WPML.

It is also best you clear all caches and deactivate your caching plugin while you’re setting up your site so you could see the results immediately.

Thanks.

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