탐색 건너뛰기

Open

Topic Tags: Compatibility

Overview of the issue

Certain strings in the PDF generated by the PDF Invoices & Packing Slips for WooCommerce plugin are not being translated, even though they are translated in WPML’s String Translation. This issue affects labels in invoice and receipt totals.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

  • Open the …/wp-content/plugins/woocommerce-pdf-ips-pro/includes/wcpdf-pro-multilingual-full.php file.
  • Look for line 297.
  • Replace:
    if ( !empty($setting['label']) ) {
    	// WPML
    	if( class_exists('\\SitePress') ) {
    		$setting['label'] = __( $setting['label'], $textdomain );
    	// Polylang
    	} elseif( function_exists('pll__') ) {
    		$setting['label'] = pll__( $setting['label'] );
    	}
    }
    
  • With:
    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'] );
    	}
    }
    
  • Generate a new PDF. This action will register the strings.
  • Go to WPML > String Translation page.
  • Look for the related strings. They should be under the wpo_wcpdf_pro textdomain.
  • Switch the string language to the default language, then translate it.

답장을 남겨주세요

주제를 유지하고 다른 사람을 존중하십시오. 이 게시물과 관련 없는 문제에 대한 도움이 필요한 경우 지원 포럼을 사용하여 채팅을 시작하거나 티켓을 제출하십시오.

다음 태그를 사용할 수 있습니다.
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>