- Trạng thái
- Đang mở
- Được báo cáo cho
- Gravity Forms Multilingual 1.7.2
- Plugin/giao diện liên quan
- Gravity Forms
- Thẻ chủ đề
- Compatibility
Tổng quan về lỗi
Nếu bạn đang sử dụng plugin Gravity Forms Polls Add-On, bạn có thể gặp phải sự cố kết quả bình chọn không hiển thị nội dung đã dịch khi xem bằng các ngôn ngữ khác với ngôn ngữ mặc định. Sự cố này chủ yếu xảy ra khi tham số shortcode được đặt thành mode="results". Các bản dịch hoạt động chính xác khi chế độ được đặt thành mode=”poll”.
Giải pháp tạm thời
Vui lòng đảm bảo đã sao lưu toàn bộ trang web của bạn trước khi tiếp tục.
- Mở tệp …/wp-content/plugins/gravityformspolls/class-gf-polls.php.
- Tìm dòng 2140.
- Ngay trước:
$gpoll_output['summary'] .= $field['field_label'] . '</div></div>';
- Thêm mã này:
// 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 } - Sau đó, tìm dòng 2184.
- Thay thế:
$gpoll_output['summary'] .= sprintf( "<div class='gpoll_choice_wrapper'><div class='gfield_description gpoll_choice_label%s'>%s</div>", $selected_class, rgar( $input, 'label' ) );
- Bằng:
// 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 );