- Stato
- In attesa dell’autore
- Plugin/tema correlato
- WooCommerce PDF Invoices & Packing Slips Professional
- Tag dell’argomento
- Compatibility
Panoramica del problema
Alcune stringhe nel PDF generato dal plugin PDF Invoices & Packing Slips for WooCommerce non vengono tradotte, anche se sono tradotte nella Traduzione stringhe di WPML. Questo problema interessa le etichette nei totali delle fatture e delle ricevute.
Soluzione alternativa
Assicurati di avere un backup completo del tuo sito prima di procedere.
- Apri il file …/wp-content/plugins/woocommerce-pdf-ips-pro/includes/wcpdf-pro-multilingual-full.php.
- Cerca la riga 297.
- Sostituisci:
if ( !empty($setting['label']) ) { // WPML if( class_exists('\\SitePress') ) { $setting['label'] = __( $setting['label'], $textdomain ); // Polylang } elseif( function_exists('pll__') ) { $setting['label'] = pll__( $setting['label'] ); } } - Con:
if ( !empty($setting['label']) ) { // WPML if( class_exists('\\SitePress') ) { $setting['label'] = __( $setting['label'], $textdomain ); // HERE $textdomain = ' wpo_wcpdf_pro'; $string_name = 'PDF String: '.substr($setting['label'], 0, 20); do_action( 'wpml_register_single_string', $textdomain, $string_name, $setting['label'] ); // Apply the translation to the string $setting['label'] = apply_filters('wpml_translate_single_string', $setting['label'] , $textdomain, $string_name); // Polylang } elseif( function_exists('pll__') ) { $setting['label'] = pll__( $setting['label'] ); } } - Genera un nuovo PDF. Questa azione registrerà le stringhe.
- Vai alla pagina WPML > Traduzione stringhe.
- Cerca le stringhe correlate. Dovrebbero trovarsi nel textdomain
wpo_wcpdf_pro. - Cambia la lingua della stringa nella lingua predefinita, quindi traducila.