【发布时间】:2019-03-01 16:27:21
【问题描述】:
我正在尝试翻译“有优惠券吗?”使用此代码在 Woocommerce 结帐页面中输入文本:
function custom_strings_translation( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'HAVE A COUPON?' :
$translated_text = __( 'TIENES UN CUPÓN?', '__x__' );
break;
}
return $translated_text;
}
add_filter('gettext', 'custom_strings_translation', 20, 3);
但它不起作用。
谁能告诉我为什么?
【问题讨论】:
标签: php wordpress woocommerce checkout gettext