//You can change to your own units of measurement (kg, ft, m, mm .....)
function localize_weight_units($weight) {
return str_replace('g', 'г', $weight);
}
add_filter('woocommerce_format_weight', 'localize_weight_units');
function localize_demensions_units($dimensions) {
return str_replace('cm', 'см', $dimensions);
}
add_filter('woocommerce_format_dimensions', 'localize_demensions_units');
Actual behavior
...
Steps to reproduce
...
WordPress Environment
At the moment, the site is installed Twenty Twenty-One 1.4 theme and only one woocommerce plugin.
Isolating the problem
I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.
This bug happens with a default WordPress theme active, or Storefront.
I can reproduce this bug consistently using the steps above.
The text was updated successfully, but these errors were encountered:
Thank you for opening the issue! It requires further feedback from the WooCommerce Core team. I am adding the needs developer feedback label to this issue so that the Core team could take a look.
Please note it may take a few days for them to get to this issue. Thank you for your patience.
Thanks for the report @renrax, marking this as a bug. Also this looks like a good first issue, as we have to find where we are rendering this and add internationalization code.
Prerequisites
Describe the bug
There is no translation for woocommerce units https://imgur.com/a/hzfvuXc.
To be more precise, it is there, but it is not displayed on the product pages https://imgur.com/a/ZR57aLK.
You added a value to the translation file. But it does not work for units.
Please, take a look at these articles, it will help you understand the essence of the existing Woocommerce Bug:
https://qna.habr.com/q/374588
https://soradmin.ru/kak-perevesti-lokalizirovat-edinicy-izmereniya-kg-m-cm-v-woocommerce/
Expected behavior
These articles find a temporary solution:
//You can change to your own units of measurement (kg, ft, m, mm .....)
function localize_weight_units($weight) {
return str_replace('g', 'г', $weight);
}
add_filter('woocommerce_format_weight', 'localize_weight_units');
function localize_demensions_units($dimensions) {
return str_replace('cm', 'см', $dimensions);
}
add_filter('woocommerce_format_dimensions', 'localize_demensions_units');
Actual behavior
...
Steps to reproduce
...
WordPress Environment
At the moment, the site is installed Twenty Twenty-One 1.4 theme and only one woocommerce plugin.
Isolating the problem
The text was updated successfully, but these errors were encountered: