WPML
الحالة
محلولة
أُبلغ عنها لـ
WPML Multilingual CMS 4.6.13
تم حلها في
WPML 4.7.2
الإضافة/القالب ذو الصلة
Elementor
وسوم الموضوع
ATE, Compatibility

نظرة عامة على المشكلة

عند ترجمة الصفحات المُنشأة بواسطة Elementor باستخدام محرر الترجمة المتقدم (ATE) من WPML، تُحذف رموز مثل < (أصغر من) أو > (أكبر من) أو تُفسر بشكل غير صحيح على أنها علامات HTML.

حل بديل مؤقت

يُرجى التأكد من أخذ نسخة احتياطية كاملة لموقعك قبل المتابعة.


  • افتح ملف …/wp-content/plugins/sitepress-multilingual-cms/classes/xliff/class-wpml-tm-xliff-writer.php.

  • ابحث عن السطر 407.

  • استبدل:
    	private function remove_line_breaks_inside_tags( $string ) {
    		return preg_replace_callback( '/(<[^>]*>)/m', array( $this, 'remove_line_breaks_inside_tag_callback' ), $string );
    	}
    
    	/**
    	 * @param array $matches
    	 *
    	 * @return string
    	 */
    	private function remove_line_breaks_inside_tag_callback( array $matches ) {
    		$tag_string = preg_replace( '/([\nr\t ]+)/', ' ', $matches[0] );
    		$tag_string = preg_replace( '/(<[\s]+)/', '<', $tag_string );
    		return preg_replace( '/([\s]+>)/', '>', $tag_string );
    	}

  • بـ:
    	private function remove_line_breaks_inside_tags( $string ) {
    	    // Match only valid HTML tags (opening, closing, or self-closing)
    	    return preg_replace_callback( '/(<\/?[a-zA-Z][^<>]*>)/m', array( $this, 'remove_line_breaks_inside_tag_callback' ), $string );
    	}
    
    	/**
    	 * @param array $matches
    	 *
    	 * @return string
    	 */
    	private function remove_line_breaks_inside_tag_callback( array $matches ) {
    	    // Remove unnecessary spaces and line breaks inside valid HTML tags
    	    $tag_string = preg_replace( '/([\nr\t ]+)/', ' ', $matches[0] );
    	    $tag_string = preg_replace( '/(<[\s]+)/', '<', $tag_string );
    	 return preg_replace( '/([\s]+>)/', '>', $tag_string );
    	}

جميع المشاكل المعروفة →