- Statut
- Ouvert
- Signalé pour
- Gravity Forms Multilingual 1.7.2
- Extension/thème associé
- Gravity Forms
- Étiquettes de sujet
- Compatibility
Aperçu de l’anomalie
Si vous utilisez l’extension Gravity Forms Polls Add-On, vous pouvez rencontrer des problèmes où les résultats des sondages n’affichent pas le contenu traduit lorsqu’ils sont consultés dans des langues autres que la langue par défaut. Ce problème se produit principalement lorsque le paramètre du shortcode est défini sur mode="results". Les traductions fonctionnent correctement lorsque le mode est défini sur mode=”poll”.
Solution de contournement
Assurez-vous d’avoir une sauvegarde complète de votre site avant de continuer.
- Ouvrez le fichier …/wp-content/plugins/gravityformspolls/class-gf-polls.php.
- Cherchez la ligne 2140.
- Juste avant :
$gpoll_output['summary'] .= $field['field_label'] . '</div></div>';
- Ajoutez ce code :
// 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 } - Ensuite, cherchez la ligne 2184.
- Remplacez :
$gpoll_output['summary'] .= sprintf( "<div class='gpoll_choice_wrapper'><div class='gfield_description gpoll_choice_label%s'>%s</div>", $selected_class, rgar( $input, 'label' ) );
- Par :
// 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 );