admin管理员组文章数量:1130349
I'm trying to change the text in the 'Place order' button on my multilingual site in WooCommerce. My default lang is English US, other is Polish. I can easily modify the secondary language text via my WPML plugin, but I cannot change the default language. I tried modifying the button text via a JS code which worked in the default EN page, but the Polish one started to display the new English text too. I also tried using Loco and adding English as a language, changed the English text - but that didn't work. How is this doable - to change text strings in default language and making them translatable via WPML in the same time?
I'm trying to change the text in the 'Place order' button on my multilingual site in WooCommerce. My default lang is English US, other is Polish. I can easily modify the secondary language text via my WPML plugin, but I cannot change the default language. I tried modifying the button text via a JS code which worked in the default EN page, but the Polish one started to display the new English text too. I also tried using Loco and adding English as a language, changed the English text - but that didn't work. How is this doable - to change text strings in default language and making them translatable via WPML in the same time?
Share Improve this question edited Dec 3, 2018 at 19:09 Chris Osiak asked Dec 3, 2018 at 14:17 Chris OsiakChris Osiak 117 bronze badges2 Answers
Reset to default 1You could use their filter to do this:
/* Add to the functions.php file of your theme */
add_filter( 'woocommerce_order_button_text', 'woo_custom_order_button_text' );
function woo_custom_order_button_text() {
return __( 'Your new button text here', 'woocommerce' );
}
If you have static texts, which are hard-coded in the PHP, you can just use GetText calls, like:
<?php __('Hello world','cool_theme'); ?>
WPML hooks to the GetText calls and makes these texts translatable via the String Translation interface. Please note that this method only works for texts that cannot be edited and are fixed in the theme.
I'm trying to change the text in the 'Place order' button on my multilingual site in WooCommerce. My default lang is English US, other is Polish. I can easily modify the secondary language text via my WPML plugin, but I cannot change the default language. I tried modifying the button text via a JS code which worked in the default EN page, but the Polish one started to display the new English text too. I also tried using Loco and adding English as a language, changed the English text - but that didn't work. How is this doable - to change text strings in default language and making them translatable via WPML in the same time?
I'm trying to change the text in the 'Place order' button on my multilingual site in WooCommerce. My default lang is English US, other is Polish. I can easily modify the secondary language text via my WPML plugin, but I cannot change the default language. I tried modifying the button text via a JS code which worked in the default EN page, but the Polish one started to display the new English text too. I also tried using Loco and adding English as a language, changed the English text - but that didn't work. How is this doable - to change text strings in default language and making them translatable via WPML in the same time?
Share Improve this question edited Dec 3, 2018 at 19:09 Chris Osiak asked Dec 3, 2018 at 14:17 Chris OsiakChris Osiak 117 bronze badges2 Answers
Reset to default 1You could use their filter to do this:
/* Add to the functions.php file of your theme */
add_filter( 'woocommerce_order_button_text', 'woo_custom_order_button_text' );
function woo_custom_order_button_text() {
return __( 'Your new button text here', 'woocommerce' );
}
If you have static texts, which are hard-coded in the PHP, you can just use GetText calls, like:
<?php __('Hello world','cool_theme'); ?>
WPML hooks to the GetText calls and makes these texts translatable via the String Translation interface. Please note that this method only works for texts that cannot be edited and are fixed in the theme.
本文标签: How to modify WooCommerce button text in default and additional languages
版权声明:本文标题:How to modify WooCommerce button text in default and additional languages 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749131301a2320631.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论