דלג לתוכן דלג לסרגל הצד

Waiting for author

Topic Tags: Compatibility, WCML

Overview of the issue

When using Germanized for WooCommerce with WPML, you might experience the following issue: the strings associated with legal checkboxes, such as the label and error message, do not appear in the WPML String Translation interface and cannot be translated.

Workaround

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

  • Add the following code to your theme’s functions.php file.
    // WPML Workaround for compsupp-8083
    if ( class_exists('Sitepress') ) { 
    
    	add_action( 'update_option_woocommerce_gzd_legal_checkboxes_settings', function( $old_value, $new_value ) {
    		$current_lang = apply_filters( 'wpml_current_language', null );
    		update_option( 'woocommerce_gzd_legal_checkboxes_settings_' . $current_lang, $new_value );
    	}, 10, 2 );
    
    	add_filter( 'pre_option_woocommerce_gzd_legal_checkboxes_settings', function( $default ) {
    
    		$current_lang = apply_filters( 'wpml_current_language', null );
    		$translated = get_option( 'woocommerce_gzd_legal_checkboxes_settings_' . $current_lang );
    
    		return is_array( $translated ) ? $translated : $default;
    	});
    	
    }
            

This workaround ensures that the checkbox strings are stored per language. Once added:

  • Go to "WooCommerce > Settings > Germanized > Legal checkboxes > (Your checkbox)" in your default language, make a small edit to the labels, and save.
  • Then switch to the secondary language using the language switcher in the top admin bar, translate the labels, and save.

השאר תגובה

אנא הישאר בנושא והיה מכבד כלפי אחרים. אם אתה זקוק לעזרה בנושאים שאינם קשורים לפוסט זה, השתמש בפורום התמיכה שלנו כדי להתחיל צ'אט או לפתוח כרטיס.

אתה יכול להשתמש בתגיות אלה:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>