我需要在Wordpress中做一些工作。我设法增加结账费用
$woocommerce->cart->add_fee( 'thebestcompany_service', $fee, true, 'standard' );
太棒了。我设法创建了一个插件。太棒了。我设法用 Loco翻译翻译我的插件。太棒了。
但我现在不在哪里翻译费用thebestcompany_service
。
插件翻译,主题翻译或woocommerce插件翻译中没有这样的字符串。请帮忙。
答案 0 :(得分:0)
要使字符串在您的函数中可翻译,您需要以这种方式使用a translatable function:
$fee_label = __( 'The best company service', 'domain_name' );
// Or (without domain name):
// $fee_label = __( 'The best company service' );
$woocommerce->cart->add_fee( $fee_label, $fee, true, 'standard' );
其中'domain_name'
必须由您的活动主题域slug或插件域slug替换,将使用该Loco翻译。
这应该现在可以使用