Translate Terms & Conditions sentence

Hello

I use the latest X-Theme version. Can you please tell me how do I translate the “I’ve read and accept the terms & conditions *” string in WooCommerce?

I just want to translate this one sentence in for example functions.php.

I have tried different solutions but without luck.

Thanks.

Hello There,

Thanks for writing in! Because what you are trying to accomplish requires a template customization, we would highly to suggest that you use a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.

After the child theme is set up, please add the following code in your child theme’s functions.php file

// Translate texts
// =============================================================================
function translate_texts($translated) { 
  $translated = str_ireplace('I&rsquo;ve read and accept the <a href=\"%s\" "
"class=\"woocommerce-terms-and-conditions-link\">terms &amp; conditions</a>', 'insert your translation here', $translated);$translated);
  
  return $translated; 
}
add_filter('gettext', 'translate_texts' );
// =============================================================================

Hope this helps. Please let us know how it goes.