WPML
สถานะ
เปิด
รายงานสำหรับ
Gravity Forms Multilingual 1.7.2
ปลั๊กอิน/ธีมที่เกี่ยวข้อง
Gravity Forms
แท็กหัวข้อ
Compatibility

ภาพรวมของปัญหา

หากคุณกำลังใช้ปลั๊กอิน Gravity Forms Polls Add-On คุณอาจพบปัญหาที่ผลโหวตไม่แสดงเนื้อหาที่แปลเมื่อดูในภาษาอื่นที่ไม่ใช่ภาษาเริ่มต้น ปัญหานี้มักจะเกิดขึ้นเมื่อมีการตั้งค่าพารามิเตอร์ shortcode เป็น mode="results" การแปลจะทำงานได้อย่างถูกต้องเมื่อตั้งค่าโหมดเป็น mode=”poll”

วิธีแก้ปัญหาชั่วคราว

โปรดตรวจสอบให้แน่ใจว่าได้สำรองข้อมูลไซต์ทั้งหมดของคุณก่อนดำเนินการต่อ


  • เปิดไฟล์ …/wp-content/plugins/gravityformspolls/class-gf-polls.php

  • ค้นหาบรรทัดที่ 2140

  • ก่อนหน้า:
    			$gpoll_output['summary'] .= $field['field_label'] . '</div></div>';

  • เพิ่มโค้ดนี้:
    			// WPML Workaround for compsupp-7316 - Part I
    			if ( class_exists('Sitepress') ) {
    				$wpml_question = $field['field_label'];
    				$textdomain = 'WordPress';
    				$string_name = 'WPML Workaround : '.substr($wpml_question, 0, 20);
    
    				$wpml_default_lang = apply_filters('wpml_default_language', NULL );
    				$wpml_current_lang = apply_filters( 'wpml_current_language', NULL );
    
    				if ($wpml_default_lang == $wpml_current_lang ) {
    					do_action( 'wpml_register_single_string', $textdomain, $string_name, $wpml_question );
    				}	
    				// Apply the translation to the string
    				$wpml_question = apply_filters('wpml_translate_single_string', $wpml_question , $textdomain, $string_name);
    
    				$field['field_label']   = $wpml_question;  // Replace the title
    			}	

  • จากนั้น ค้นหาบรรทัดที่ 2184

  • แทนที่:
    				$gpoll_output['summary'] .= sprintf( "<div class='gpoll_choice_wrapper'><div class='gfield_description gpoll_choice_label%s'>%s</div>", $selected_class, rgar( $input, 'label' ) );

  • ด้วย:
    				// WPML Workaround for compsupp-7316 - Part II
    				if ( class_exists('Sitepress') ) {
    					$string = rgar( $input, 'label' );
    					$textdomain = 'WordPress';
    					$string_name = 'WPML Workaround : '.substr($string, 0, 20);
    
    					$wpml_default_lang = apply_filters('wpml_default_language', NULL );
    					$wpml_current_lang = apply_filters( 'wpml_current_language', NULL );
    
    					if ($wpml_default_lang == $wpml_current_lang ) {
    						do_action( 'wpml_register_single_string', $textdomain, $string_name, $string );
    					}	
    					// Apply the translation to the string
    					$string = apply_filters('wpml_translate_single_string', $string , $textdomain, $string_name);
    
    					$wpml_poll_label   = $string;  // Replace the title
    				}
    				$gpoll_output['summary'] .= sprintf( "<div class='gpoll_choice_wrapper'><div class='gfield_description gpoll_choice_label%s'>%s</div>", $selected_class, $wpml_poll_label );

ปัญหาที่ทราบแล้วทั้งหมด →