1 回答
TA贡献1811条经验 获得超5个赞
通过名为的内置 WordPress 过滤器翻译字符串gettext可能是更好的方法,特别是因为翻译应该是站点范围的,而不仅仅是在电子邮件上,示例如下:
add_filter( 'gettext', 'my_custom_string_translation', 999, 3 );
function my_custom_string_translation( $translated, $text, $domain ) {
$translated = str_ireplace( 'Subtotal', 'Your translation here.', $translated );
$translated = str_ireplace( 'Discount', 'Your translation here.', $translated );
$translated = str_ireplace( 'Shipping', 'Your translation here.', $translated );
$translated = str_ireplace( 'Payment Method', 'Your translation here.', $translated );
$translated = str_ireplace( 'Total', 'Your translation here.', $translated );
return $translated;
}
您可以将上面的代码放在您的functions.php或自定义插件文件中。
- 1 回答
- 0 关注
- 171 浏览
添加回答
举报