/* ---- Libellés du configurateur en français à la source (évite le remplacement JS qui se bat avec GTranslate) ---- */ add_filter( 'gettext', function ( $translated, $text, $domain ) { if ( 'product-woo-configurator' === $domain ) { if ( 'Total Price' === $text ) { return 'Prix total'; } if ( 'Base Price' === $text ) { return 'Prix de base'; } } if ( 'woocommerce' === $domain ) { if ( 'Order summary' === $text ) { return 'Résumé de la demande'; } if ( 'Payment options' === $text ) { return 'Demande de devis gratuit'; } } return $translated; }, 20, 3 ); /* ---- Mêmes libellés côté JS pour les blocs Panier / Commande (chaînes rendues en JavaScript) ---- */ add_action( 'wp_enqueue_scripts', function () { if ( ! function_exists( 'is_checkout' ) || ! ( is_checkout() || is_cart() ) ) { return; } $js = "(function(){if(!window.wp||!wp.hooks){return;}var map={'Order summary':'Résumé de la demande','Payment options':'Demande de devis gratuit','Place Order':'Envoyer ma demande de devis'};" . "wp.hooks.addFilter('i18n.gettext_woocommerce','eclassic/devis',function(t,text){return map[text]||t;});" . "wp.hooks.addFilter('i18n.gettext','eclassic/devis',function(t,text){return map[text]||t;});})();"; wp_add_inline_script( 'wp-i18n', $js, 'after' ); }, 5 );