تخطي إلى المحتوى تخطي إلى الشريط الجانبي

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>