Bỏ qua điều hướng

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;
    }
    

Để lại trả lời

Vui lòng bám sát chủ đề và tôn trọng người khác. Nếu bạn cần trợ giúp về các vấn đề không liên quan đến bài đăng này, hãy sử dụng Diễn đàn Hỗ trợ của chúng tôi để bắt đầu trò chuyện hoặc gửi yêu cầu hỗ trợ.

Bạn có thể sử dụng các thẻ này:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>