WPML
Status
Aberto
Relatado para
Gravity Forms Multilingual 1.7.2
Plugin/tema relacionado
Gravity Forms
Tags de tópico
Compatibility

Visão geral do problema

Se você estiver usando o plugin Gravity Forms Polls Add-On, poderá enfrentar problemas em que os resultados da enquete não exibem o conteúdo traduzido quando visualizados em idiomas diferentes do idioma padrão. Esse problema ocorre principalmente quando o parâmetro do shortcode é definido como mode="results". As traduções funcionam corretamente quando o modo é definido como mode=”poll”.

Solução alternativa

Certifique-se de ter um backup completo do site antes de prosseguir.


  • Abra o arquivo …/wp-content/plugins/gravityformspolls/class-gf-polls.php.

  • Procure a linha 2140.

  • Logo antes de:
    			$gpoll_output['summary'] .= $field['field_label'] . '</div></div>';

  • Adicione este código:
    			// WPML Workaround for compsupp-7316 - Part I
    			if ( class_exists('Sitepress') ) {
    				$wpml_question = $field['field_label'];
    				$textdomain = 'WordPress';
    				$string_name = 'WPML Workaround : '.substr($wpml_question, 0, 20);
    
    				$wpml_default_lang = apply_filters('wpml_default_language', NULL );
    				$wpml_current_lang = apply_filters( 'wpml_current_language', NULL );
    
    				if ($wpml_default_lang == $wpml_current_lang ) {
    					do_action( 'wpml_register_single_string', $textdomain, $string_name, $wpml_question );
    				}	
    				// Apply the translation to the string
    				$wpml_question = apply_filters('wpml_translate_single_string', $wpml_question , $textdomain, $string_name);
    
    				$field['field_label']   = $wpml_question;  // Replace the title
    			}	

  • Em seguida, procure a linha 2184.

  • Substitua:
    				$gpoll_output['summary'] .= sprintf( "<div class='gpoll_choice_wrapper'><div class='gfield_description gpoll_choice_label%s'>%s</div>", $selected_class, rgar( $input, 'label' ) );

  • Por:
    				// WPML Workaround for compsupp-7316 - Part II
    				if ( class_exists('Sitepress') ) {
    					$string = rgar( $input, 'label' );
    					$textdomain = 'WordPress';
    					$string_name = 'WPML Workaround : '.substr($string, 0, 20);
    
    					$wpml_default_lang = apply_filters('wpml_default_language', NULL );
    					$wpml_current_lang = apply_filters( 'wpml_current_language', NULL );
    
    					if ($wpml_default_lang == $wpml_current_lang ) {
    						do_action( 'wpml_register_single_string', $textdomain, $string_name, $string );
    					}	
    					// Apply the translation to the string
    					$string = apply_filters('wpml_translate_single_string', $string , $textdomain, $string_name);
    
    					$wpml_poll_label   = $string;  // Replace the title
    				}
    				$gpoll_output['summary'] .= sprintf( "<div class='gpoll_choice_wrapper'><div class='gfield_description gpoll_choice_label%s'>%s</div>", $selected_class, $wpml_poll_label );

Todos os problemas conhecidos →