ข้ามไปยังเนื้อหาหลัก ข้ามไปยังแถบด้านข้าง

Open

Topic Tags: Compatibility

Overview of the issue

If you are using the RSVP Pro plugin, you may encounter issues where some strings do not display as translated on the frontend when using WPML. This problem typically arises due to the string’s unique key exceeding the character limit set by the system, resulting in mismatched keys and untranslated strings.

Workaround

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

  • Open the app/public/wp-content/plugins/rsvp-pro-plugin/includes/rsvp-utils.inc.php file
  • Look for line 1069.
  • Replace:
    function rsvp_pro_get_dynamic_translated_string( $key_name, $string, $event_id ) {
    	$text = $string;
    
    	if ( function_exists( 'pll__' ) ) {
    		$text = pll__( $string );
    	}
    
    	if ( has_filter( 'wpml_translate_string' ) ) {
    		$event_name = rsvp_pro_get_event_name( $event_id );
    		$package    = array(
    			'kind'  => "RSVPPro - {$event_id}",
    			'name'  => "rsvp-pro-plugin-{$event_id}",
    			'title' => "RSVP Pro Plugin - {$event_name}",
    		);
    		$key_name   = strtolower( $key_name );
    		$key_name   = str_replace( ' ', '-', $key_name );
    		$text       = apply_filters( 'wpml_translate_string', $string, $key_name, $package );
    	}
    
    	return $text;
    }
    
  • With:
    function rsvp_pro_get_dynamic_translated_string( $key_name, $string, $event_id ) {
    	$text = $string;
    
    	if ( function_exists( 'pll__' ) ) {
    		$text = pll__( $string );
    	}
    
    	if ( has_filter( 'wpml_translate_string' ) ) {
    		$event_name = rsvp_pro_get_event_name( $event_id );
    		$package    = array(
    			'kind'  => "RSVPPro - {$event_id}",
    			'name'  => "rsvp-pro-plugin-{$event_id}",
    			'title' => "RSVP Pro Plugin - {$event_name}",
    		);
    		$key_name   = strtolower( $key_name );
    		$key_name   = str_replace( ' ', '-', $key_name );
    
    		// WPML Workaround for compsupp-7503
    		$key_name = substr($key_name, 0, 160);
    		
    		$text       = apply_filters( 'wpml_translate_string', $string, $key_name, $package );
    	}
    
    	return $text;
    }
    

แสดงความคิดเห็น

โปรดอยู่ในหัวข้อและให้ความเคารพผู้อื่น หากคุณต้องการความช่วยเหลือในประเด็นที่ไม่เกี่ยวข้องกับโพสต์นี้ ให้ใช้ฟอรัมสนับสนุนของเราเพื่อเริ่มการแชทหรือส่งตั๋ว.

คุณสามารถใช้แท็กเหล่านี้:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>