This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
This topic contains 4 replies, has 2 voices.
Last updated by alexandreG-2 4 years, 7 months ago.
Assisted by: Diego Pereira.
Author | Posts |
---|---|
June 23, 2020 at 10:00 am #6433365 | |
alexandreG-2 |
Hello, thank you in advance for the help you will provide. I've been looking for the string to translate it but impossible to find it in wpml plugin so I used the following code placed in the functions.php file: add_filter('woocommerce_sale_flash', 'woocommerce_custom_sale_text', 10, 3); but unfortunately, it doesn't help with translations. Here is the link to my website: hidden link Cheers, Alex. |
June 23, 2020 at 7:09 pm #6437535 | |
Diego Pereira Supporter
Languages: English (English ) Spanish (Español ) Portuguese (Brazil) (Português ) Timezone: America/Sao_Paulo (GMT-03:00) |
Hello, welcome to the WPML support Forum! Please try the following: add_filter('woocommerce_sale_flash', 'woocommerce_custom_sale_text', 10, 3); function woocommerce_custom_sale_text($text, $post, $_product) { return __('<span class="onsale">Pre Order</span>', 'your-theme-textdomain-here'); } - Make sure you have the Translation Magagement and String Translator extensions active. If not, you can download here: https://wpml.org/account/downloads/ Ref: https://wpml.org/documentation/getting-started-guide/string-translation/ Please let me know if it worked for you. |
June 23, 2020 at 9:14 pm #6438443 | |
alexandreG-2 |
Hi Diego, thank you for your reply. |
June 24, 2020 at 1:35 pm #6444801 | |
Diego Pereira Supporter
Languages: English (English ) Spanish (Español ) Portuguese (Brazil) (Português ) Timezone: America/Sao_Paulo (GMT-03:00) |
Hi there, Please try the following: If it does not work, you can try with the following function: add_filter('woocommerce_sale_flash', 'woocommerce_custom_sale_text', 10, 3); function woocommerce_custom_sale_text($text, $post, $_product) { //French Language if ( defined( 'ICL_LANGUAGE_CODE' ) && 'fr' == ICL_LANGUAGE_CODE ) { return '<span class="onsale">Pré-commande</span>'; } //English Language else { return '<span class="onsale">Pre Order</span>'; } } Please let me know if it worked for you. |
June 24, 2020 at 2:14 pm #6445219 | |
alexandreG-2 |
Thanks Diego! The last solution worked perfectly!!! |