Support » Plugin: WooCommerce Multilingual - run WooCommerce with WPML » Add ability for email textarea to be translatable (code included)

  • Hi,

    When editing a woocommerce email I needed to translate the additional content of the email for each language. I have used the wcml_emails_text_keys_to_translate filter to add in the key additional_content. However the language dropdown does not appear as currently in your code you only support input fields, and not textarea. Please find my code below in which i fix this issue. Any chance you can include this in as a feature?

    All changes are done in inc/class-wcml-emails.php

    Find:
    $st_page = admin_url( 'admin.php?page=' . WPML_ST_FOLDER . '/menu/string-translation.php&context=admin_texts_'.$emails_option.'&search='.$setting_value );

    Replace with:

    $safe_setting_value = urlencode($setting_value);
    
    			                $st_page = admin_url( 'admin.php?page=' . WPML_ST_FOLDER . '/menu/string-translation.php&context=admin_texts_'.$emails_option.'&search='.$safe_setting_value );

    The fix above allows multi line content and fixes single quote issues as well.

    Find:

    var input = jQuery('input[name="<?php echo $input_name ?>"]');

    Below add:

    
     if (!input.length) {
    var input = jQuery('textarea[name="<?php echo $input_name  ?>"]');
    }

    This code will then search for a textarea if no input field exists.

    Therefore additional content is now supported.

    • This topic was modified 2 months, 2 weeks ago by thomassultana.
Viewing 1 replies (of 1 total)
  • Plugin Author sergey.r

    (@sergeyr-1)

    Hello Thomassultana,
    Thanks for a detailed description and suggestion to improve our plugin.

    I’ll create a ticket for this and we will include this to one of the next releases.

    Thanks!

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