Translate XX Comments on Blog page

I have translated some words using the function but can’t translate the word XX comments on the page(check secured link)

$translation = array (
'word' => 'Translated word'
);
if( isset( $translation[$text] ) ) {
return $translation[$text];
}

return $translated_text;

}

Hi @faizan

You can add this snippet in functions.php in your child theme directory:

add_filter( 'ngettext', 'x_edit_integrity_comment_title', 10, 5 );
function x_edit_integrity_comment_title($translation, $single, $plural, $number, $domain){
  $translation = str_ireplace('%s Comment', '%s Translated Comment', $translation);
  $translation = str_ireplace('%s Comments', '%s Translated Comments', $translation);
  return $translation;
}

Change Translated Comment and Translated Comments as you like.

Check this guide to know how to create and use Child theme:

Thanks.

Thanks! It worked.

How about translating on hover text in the author box social icon “Visit the Facebook profile for XX”

Hi there,

I tried checking your site but I am not seeing any Facebook like in the author box of the posts.

If you aim to translate many texts on your site, you could do the steps mentioned here instead:

Hope this helps.

Please check the secure note for the link.
When you hover on social icons below gravatar, you see English text which I need to translate. Your official method is already tried.

Hi @faizan,

It appears that those texts aren’t translatable, I’ll add this as a bug to our issue tracker. For a temporary workaround, please edit this file in your cornerstone plugin through FTP, cornerstone\includes\shortcodes\author.php and translate these lines

$facebook_output = ( $facebook ) ? "<a href=\"{$facebook}\" class=\"x-author-social\" title=\"Visit the Facebook Profile for {$display_name}\" target=\"_blank\"><i class=\"x-icon-facebook-square\" data-x-icon=\"&#xf082;\"></i> Facebook</a>" : ''; $twitter_output = ( $twitter ) ? "<a href=\"{$twitter}\" class=\"x-author-social\" title=\"Visit the Twitter Profile for {$display_name}\" target=\"_blank\"><i class=\"x-icon-twitter-square\" data-x-icon=\"&#xf081;\"></i> Twitter</a>" : ''; $googleplus_output = ( $googleplus ) ? "<a href=\"{$googleplus}\" class=\"x-author-social\" title=\"Visit the Google+ Profile for {$display_name}\" target=\"_blank\"><i class=\"x-icon-google-plus-square\" data-x-icon=\"&#xf0d4;\"></i> Google+</a>" : '';

Thanks!

this will be fixed in the next update, right?

Hi There,

This issue has been added to our bug tracker and should be fixed in next update.

Stay tuned :slight_smile:

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

@faizan I wanted to give you a heads up that this was fixed in today’s update.

2 Likes