Translation weglot

Hello,

i installed weglot on my website. Weglot is translating through html parsing, therefore my woocommerce payment module on the checkout page isn’t translated

, because the content is generated through JS (dixit weglot support)

i tried adding this php code but it’s not working

<?php

if (is_checkout()) {

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "https://cammo.fr/en/commander/");
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

	$html = curl_exec($ch);

	$dom = new DOMDocument();

	@ $dom->loadHTML($html);

	$checkouttext = $dom->textContent;

	if (str_contains($checkouttext, "Billing details")) {
	
		add_filter( 'gettext', 'checkouttext', 99, 2 );
	
		function checkouttext( $translation, $text ) { 
	 	  if ( $text === 'Moyens de paiement populaires' ) { 
 	  	  	return 'Payment methods';    
		  }    	  
	  	  return $translation;
		  }	
	
	}
}

would someone know how to solve my problem ?

Thank you !

Steve

Sponsor our Newsletter | Privacy Policy | Terms of Service