Support » Plugin: Product Enquiry for WooCommerce » Translation of Button with WPML

  • Resolved toniface

    (@toniface)


    Hi,

    We’ve tried to translate the button for rnquiry information with WPML an it’s impossible. I contacted with the people of WPML and they tell me that I must change the code. We sent me the changes but tell me, that obviously when the plugin be updated the cahnges dissapear and they suggest me that contact with creators of the plugin to send this changes and if you are OK, include in next updates.

    The changes are:

    A) Line 74: CHANGE:

    <?php echo esc_html( $enq_btn_label ); ?>

    FOR:

    <?php esc_html_e( $enq_btn_label, 'WC Enquiry btn' ); ?>

    B) Line 78: CHANGE:

    <input type=”button” name=”contact” value=”<?php echo esc_attr( $enq_btn_label); ?>” class=”contact pe-show-enq-modal wpi-button single_add_to_cart_button button alt” />

    FOR:

    <input type=”button” name=”contact” value=”<?php esc_attr_e( $enq_btn_label,'WC Enquiry btn attr' ); ?>” class=”contact pe-show-enq-modal wpi-button single_add_to_cart_button button alt” />

    C) Line 93 (this is what it solves): CHANGE

    return empty( $form_data['custom_label'] ) ? esc_attr( __( 'Make an enquiry for this product', 'product-enquiry-for-woocommerce' ) ) : esc_attr( $form_data['custom_label'] );

    FOR:
    return empty( $form_data['custom_label'] ) ? esc_attr( __( 'Make an enquiry for this product', 'product-enquiry-for-woocommerce' ) ) : esc_attr( __($form_data['custom_label'],'WC Enquiry btn custom label setting' ) );

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author WisdmLabs

    (@wisdmlabs)

    Hey @toniface

    Please try the following codes. We have changed the text-domain to product-enquiry-for-woocommerce. After analyzing, we will include these changes in the future version of the plugin. Before updating the plugin, please contact us with ticket #64602.

    A:
    Replace the following:

    <?php echo esc_html( $enq_btn_label ); ?>
    with
    <?php esc_html_e($enq_btn_label, 'product-enquiry-for-woocommerce'); ?>

    B:
    Replace the following:

    <input type=”button” name=”contact” value=”<?php echo esc_attr( $enq_btn_label); ?>” class=”contact pe-show-enq-modal wpi-button single_add_to_cart_button button alt” />
    with
    <input type=”button” name=”contact” value=”<?php esc_attr_e($enq_btn_label, 'product-enquiry-for-woocommerce'); ?>” class=”contact pe-show-enq-modal wpi-button single_add_to_cart_button button alt” />

    C:
    Replace the following

    return empty( $form_data['custom_label'] ) ? esc_attr( __( 'Make an enquiry for this product', 'product-enquiry-for-woocommerce' ) ) : esc_attr( $form_data['custom_label'] );
    with
    return empty( $form_data['custom_label'] ) ? esc_attr( __( 'Make an enquiry for this product', 'product-enquiry-for-woocommerce' ) ) : esc_attr( __($form_data['custom_label'], 'prod

    Please test it at your end and let us know if this works well for you 🙂

    • This reply was modified 3 months ago by WisdmLabs.
    Thread Starter toniface

    (@toniface)

    Hi,

    I can’t find the text of point B.

    Can you check it? It’s from another file?

    Thanks!

    Plugin Author WisdmLabs

    (@wisdmlabs)

    Hey @toniface

    We will get back to you within the next 12 hours 🙂

    Plugin Author WisdmLabs

    (@wisdmlabs)

    Hey @toniface

    1. Replace the body of the function render_enquiry_button() with the following:

    public function render_enquiry_button() {
            $form_data = Product_Enquiry_For_Woocommerce::pe_settings();
            global $is_product;
            // this is used to render enquiry form on product.
            // If it set to false then form will not be rendered.
            $is_product    = true;
            $enq_btn_label = $this->get_enquiry_button_label();
            ?>
            <div id="enquiry" class="pe-enq-wrapper">
                <?php
                if ( ! empty( $form_data['show_button_as_link'] ) ) :
                    ?>
                    <a href="#" class="contact pe-show-enq-modal pe-enq-btn-link"><?php echo esc_html( $enq_btn_label ); ?></a>
                    <?php
                else :
                    ?>
                    <input type="button" name="contact" value="<?php echo esc_attr( $enq_btn_label ); ?>" class="contact pe-show-enq-modal wpi-button single_add_to_cart_button button alt" />
                    <?php
                endif;
                ?>
            </div>
            <?php
        }

    2. Replace the body of the function get_enquiry_button_label with the following:

    public function get_enquiry_button_label() {
            $form_data = Product_Enquiry_For_Woocommerce::pe_settings();
    
            return empty( $form_data['custom_label'] ) ? esc_html__( 'Make an enquiry for this product', 'product-enquiry-for-woocommerce' ) : esc_html__( $form_data['custom_label'], 'product-enquiry-for-woocommerce');
        }

    Please let us know if this works 🙂

    Thread Starter toniface

    (@toniface)

    It works!

    Thanks!

    Plugin Author WisdmLabs

    (@wisdmlabs)

    Hey @toniface

    We will be closing the ticket as the issue is resolved. Please feel free to contact us if you need any further assistance, we are more than happy to help 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.