Comment elements translation

Hi support team. I canot find the way to translate two elements of the comment display here https://projeteurope.ca/lancement-du-roman-sous-les-glaces-deurope/

  1. The Reply link/button
  2. The EDIT link/button when logged in

I have tried the solution proposed in this topic #42971 without succes.

Hey @philippe_bonneau,

Thanks for writing in! The code in the old thread needs to be updated. Use this instead:

add_filter('gettext', 'translate_texts');
function translate_texts($translated) { 
	$translated = str_ireplace('Reply <span class="comment-reply-link-after">' . x_icon_get("f3e5", "x-icon-reply") . '</span>', 'Your Reply text <span class="comment-reply-link-after">' . x_icon_get("f3e5", "x-icon-reply") . '</span>', $translated);
	$translated = str_ireplace(x_icon_get("f044", "x-icon-edit") . ' Edit', x_icon_get("f044", "x-icon-edit") . ' Your Edit text', $translated);
	return $translated; 
}

Don’t forget to replace the Your text text with yours.

Kindly let us know how it goes.

Hi @ruenel. WordPress do not save the functions.php file because of an error on this line

$translated = str_ireplace('Reply <span class="comment-reply-link-after">' . x_icon_get("f3e5", "x-icon-reply") . '</span>', 'Your Reply text <span class="comment-reply-link-after">' . x_icon_get("f3e5", "x-icon-reply") . '</span>', $translated);

Hi @philippe_bonneau,

I have checked the code given by my colleague, and it worked perfectly fine, and there is no error shown in my local environment. Can you please add it once again and check?

Thanks

@tristup, I still get an error with the WordPrees edit theme file. I have paster the code in the functions.php file via the cPanel and the site do not load after that.

@philippe_bonneau,

You can paste your functions.php code here to check if there are some PHP errors:

If you can enable WP debug, we can trace the root cause of your issue.

Hope that helps.

Here is the complete error message if it can help:

Vos modifications de code PHP ont été annulées en raison d’une erreur sur la ligne 28 du fichier wp-content/themes/pro-child/functions.php. Veuillez la corriger et réessayer d’enregistrer.

Uncaught Error: Call to undefined function x_icon_get() in wp-content/themes/pro-child/functions.php:28
Stack trace:
#0 wp-includes/class-wp-hook.php(326): translate_texts()
#1 wp-includes/plugin.php(205): WP_Hook->apply_filters()
#2 wp-includes/l10n.php(206): apply_filters()
#3 wp-includes/l10n.php(306): translate()
#4 wp-content/themes/pro/cornerstone/includes/dynamiccontent/users.php(9): __()
#5 wp-content/themes/pro/cornerstone/includes/classes/Plugin.php(59): require_once(’/home/projeteu/…’)
#6 wp-content/themes/pro/cornerstone/includes/classes/Plugin.php(40): Themeco\Cornerstone\Plugin->load_config_files()
#7 wp-content/themes/pro/cornerstone/includes/boot.php(53): Themeco\Cornerstone\Plugin->initialize()
#8 wp-content/themes/pro/framework/setup.php(61): cornerstone_boot()
#9 wp-content/themes/pro/framework/setup.php(68): pro_load_cornerstone()
#10 wp-content/themes/pro/framework/classes/Theme.php(95): require_once(’/home/projeteu/…’)
#11 wp-content/themes/pro/functions.php(37): Themeco\Theme\Theme->boot()
#12 wp-settings.php(663): include(’/home/projeteu/…’)
#13 wp-config.php(86): require_once(’/home/projeteu/…’)
#14 wp-load.php(50): require_once(’/home/projeteu/…’)
#15 wp-admin/admin.php(34): require_once(’/home/projeteu/…’)
#16 wp-admin/theme-editor.php(10): require_once(’/home/projeteu/…’)
#17 {main}
thrown

Hi @philippe_bonneau,

In that case, we need to investigate it through the WordPress admin dashboard and the file where you have added the code. I would suggest you please provide login credentials for your site in a secure note to examine it further, including:

– WordPress Site URL & Login URL
– WordPress Admin username/password
– FTP/CPanel credentials to access the files.

To create a secure note, click the key icon underneath any of your posts.

Thanks

The functions.php of the Pro child theme is here functions.phphttps://dev.projeteurope.ca/wp-admin/theme-editor.php?file=functions.php&theme=pro-child

If this is not enough I will provide FTP credentials to access the files.

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