For the term Product
I've managed to change admin dash labels and WooCommerce post type labels such as 'edit_item'=> __('Edit Property',....
However, WooCommerce seems to have Products
, the plural of product in a few different places. For example; Admin Dash -> WooCommerce -> Settings ... Menu = (General, Products, Payments) etc.
So when I try to translate 'Product to Property' and 'Products to Properties', it seems to create the word Propertys
Would I be approaching this in the wrong way? Any advice please on where I'm going wrong?
Thanks,
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;
}
CodePudding user response:
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;
}