Skip Navigation

Resolved

Reported for: Gravity Forms Multilingual 1.7.2

Resolved in: Gravity Forms Multilingual 1.8.0

Topic Tags: Compatibility

Overview of the issue

Users of Gravity Forms plugin may encounter an issue where the Continue button text in the Conversational Forms Add-On is not translatable through WPML.

Workaround

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

  • Open …/wp-content/plugins/gravityformsconversationalforms/includes/theme-layers/layers/views/class-conversational-field-markup.php file
  • Look for line 67.
  • Replace:
    private function get_field_footer( $form_id, $field ) {
    	$continue_button_settings = $this->get_setting( 'continue_button_text', $form_id );
    
    	/* Translators: ⏎: Symbol for enter key on keyboard. */
    	$field_nav_text = esc_html__( 'Press Enter', 'gravityformsconversationalforms' );
    
    	return '<div class="gform-conversational__field-footer"><div class="gform-conversational__field-nav"><button type="button" class="gform-conversational__nav-button gform-conversational__nav-button--next-field_' . $form_id . '_' . $field['id'] .' gform-button active" data-js="gform-conversational-nav-field-next">' . $continue_button_settings . '</button>' .
    		'<span class="gform-conversational__field-nav-helper-text">' . $field_nav_text . '<span class="gform-conversational__field-nav-helper-icon gform-orbital-icon gform-orbital-icon--arrow-back" aria-hidden="true"></span></span></div></div>';
    }
    
  • With:
    private function get_field_footer( $form_id, $field ) {
    	$continue_button_settings = $this->get_setting( 'continue_button_text', $form_id );
    
    	// WPMl Workaround for compsupp-7398
    	if ( class_exists('Sitepress') ) {
    
    		$textdomain = 'gravityforms';
    		$string_name = 'Gravity Forms: '.substr($string, 0, 20);
    	
    		if ( apply_filters('wpml_default_language', NULL ) == apply_filters( 'wpml_current_language', NULL )) {
    			do_action( 'wpml_register_single_string', $textdomain, $string_name, $continue_button_settings);
    		}	
    		// Apply the translation to the string
    		$continue_button_settings = apply_filters('wpml_translate_single_string', $continue_button_settings , $textdomain, $string_name);
    	}
    	
    
    	/* Translators: &#9166;: Symbol for enter key on keyboard. */
    	$field_nav_text = esc_html__( 'Press Enter', 'gravityformsconversationalforms' );
    
    	return '<div class="gform-conversational__field-footer"><div class="gform-conversational__field-nav"><button type="button" class="gform-conversational__nav-button gform-conversational__nav-button--next-field_' . $form_id . '_' . $field['id'] .' gform-button active" data-js="gform-conversational-nav-field-next">' . $continue_button_settings . '</button>' .
    		'<span class="gform-conversational__field-nav-helper-text">' . $field_nav_text . '<span class="gform-conversational__field-nav-helper-icon gform-orbital-icon gform-orbital-icon--arrow-back" aria-hidden="true"></span></span></div></div>';
    }
    
  • Visit the page with the issue in the original language. This will register a new string.
  • Go to WPML > String Translation and translate the string. It should be under gravityforms textdomain.