如何将 WooCommerce 术语 'Products' 翻译成 'Properties'
How to translate WooCommerce term 'Products' to 'Properties'
对于术语 Product
,我已经设法更改了管理破折号标签和 WooCommerce post 类型标签,例如 'edit_item'=> __('Edit Property',....
但是,WooCommerce 似乎在几个不同的地方有 Products
产品的复数形式。例如; Admin Dash -> WooCommerce -> Settings ... Menu = (General, Products, Payments) 等
所以当我尝试翻译 'Product to Property' 和 'Products to Properties' 时,它似乎创造了 Propertys
这个词
我会不会以错误的方式处理这个问题?请问我哪里出错了?
谢谢,
add_filter('gettext', 'translate_text');
add_filter('ngettext', 'translate_text');
function translate_text($translated) {
$translated = str_ireplace('Product', 'Property', $translated);
$translated = str_ireplace('Products', 'Properties', $translated);
$translated = str_ireplace('Product Categories', 'Property Categories', $translated);
return $translated;
}
add_filter('gettext', 'translate_text');
add_filter('gettext_woocommerce', 'translate_text');
add_filter('ngettext', 'translate_text');
function translate_text($translated) {
$translated = str_ireplace('Products', 'Properties', $translated);
$translated = str_ireplace('Product', 'Property', $translated);
$translated = str_ireplace('Product Categories', 'Property Categories', $translated);
return $translated;
}
对于术语 Product
,我已经设法更改了管理破折号标签和 WooCommerce post 类型标签,例如 'edit_item'=> __('Edit Property',....
但是,WooCommerce 似乎在几个不同的地方有 Products
产品的复数形式。例如; Admin Dash -> WooCommerce -> Settings ... Menu = (General, Products, Payments) 等
所以当我尝试翻译 'Product to Property' 和 'Products to Properties' 时,它似乎创造了 Propertys
我会不会以错误的方式处理这个问题?请问我哪里出错了?
谢谢,
add_filter('gettext', 'translate_text');
add_filter('ngettext', 'translate_text');
function translate_text($translated) {
$translated = str_ireplace('Product', 'Property', $translated);
$translated = str_ireplace('Products', 'Properties', $translated);
$translated = str_ireplace('Product Categories', 'Property Categories', $translated);
return $translated;
}
add_filter('gettext', 'translate_text');
add_filter('gettext_woocommerce', 'translate_text');
add_filter('ngettext', 'translate_text');
function translate_text($translated) {
$translated = str_ireplace('Products', 'Properties', $translated);
$translated = str_ireplace('Product', 'Property', $translated);
$translated = str_ireplace('Product Categories', 'Property Categories', $translated);
return $translated;
}