如何在 Woocommerce 中本地化自定义费用标签?
How to localize a custom fee label in Woocommerce?
我需要在 Wordpress 中做一些工作。我成功地为结帐添加了费用
$woocommerce->cart->add_fee( 'thebestcompany_service', $fee, true, 'standard' );
太好了。我设法创建了一个插件。那太棒了。我设法用 Loco translate 翻译了我的插件。太棒了
但是我现在不知道哪里有翻译费thebestcompany_service
.
插件翻译、主题翻译或woocommerce插件翻译中没有该字符串。请帮忙
要使 The string 在您的函数中可翻译,您需要这样使用 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'
必须替换为您的活动主题域别名或插件域别名,Loco 翻译将要使用。
现在应该可以了
我需要在 Wordpress 中做一些工作。我成功地为结帐添加了费用
$woocommerce->cart->add_fee( 'thebestcompany_service', $fee, true, 'standard' );
太好了。我设法创建了一个插件。那太棒了。我设法用 Loco translate 翻译了我的插件。太棒了
但是我现在不知道哪里有翻译费thebestcompany_service
.
插件翻译、主题翻译或woocommerce插件翻译中没有该字符串。请帮忙
要使 The string 在您的函数中可翻译,您需要这样使用 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'
必须替换为您的活动主题域别名或插件域别名,Loco 翻译将要使用。
现在应该可以了