• Hello, I’m using the plugin and works great.

    I’m searching for a way to translate the notice based on wpml defined languages.

    How can I do this? Is there some filters or actions to do this?

    Best Regards

Viewing 1 replies (of 1 total)
  • Thread Starter pedrodigitalgreen

    (@pedrodigitalgreen)

    Has I needed the message translated I did this clumsy fix, however it’s not ideal and if someone has a better way to translate the messages of the plugin it would be much appreciated.

    Best Regards

    add_filter('woocommerce_add_error','dg_translate_error_messages',1,99);
    function dg_translate_error_messages($message){
    	
    	$the_lang = $_GET['lang']?:'pt';
    	$message_to_translate = 'A Encomenda deverá ter o valor mínimo de 10€ (excluindo envio).';
    	
    	//check the message to translate
    	if($message == $message_to_translate){
    		
    		if($the_lang == 'fr'){
    			$message = 'La Commande doit avoir un montant minimum de 10€ (hors frais de port).';
    		}
    
    		if($the_lang == 'es'){
    			$message = 'El Pedido debe tener un valor mínimo de 10 € (sin gastos de envío).';
    		}
    
    		if($the_lang == 'en'){
    			$message = 'The Order must have a minimum value of €10 (excluding shipping).';
    		}
    	}
    	
    	return $message;
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Translate the error messagens using WPML or code’ is closed to new replies.