如何本地化 Woo 商业权重

因此,在俄语中,在Woocommerce重量和其他公制系统的设置中。但在产品页面中,例如它仍然以英语(g - gramm)显示。我已将文件复制到我的主题中:我应该在此文件中执行哪些操作才能以俄语显示正确的重量公制系统?此代码没有帮助:/wp-content/themes/my_theme/woocommerce/single-product/product-attributes.php


<td class="product_weight"><?php echo wc_format_localized_decimal( $product->get_weight() ) . ' ' . __(esc_attr( get_option( 'woocommerce_weight_unit' ) ), 'woocommerce'); ?></td>

代码 :/product-attributes.php


defined( 'ABSPATH' ) || exit;


if ( ! $product_attributes ) {

    return;

}

?>

<table class="woocommerce-product-attributes shop_attributes">

    <?php foreach ( $product_attributes as $product_attribute_key => $product_attribute ) : ?>

        <tr class="woocommerce-product-attributes-item woocommerce-product-attributes-item--<?php echo esc_attr( $product_attribute_key ); ?>">

            <th class="woocommerce-product-attributes-item__label"><?php echo wp_kses_post( $product_attribute['label'] ); ?></th>

            <td class="woocommerce-product-attributes-item__value"><?php echo wp_kses_post( $product_attribute['value'] ); ?></td>

        </tr>

    <?php endforeach; ?>

</table>

谢谢!


开心每一天1111
浏览 92回答 1
1回答

手掌心

完成,刚刚在主题的函数中发布了此代码.phpfunction localize_weight_units($weight) {&nbsp; &nbsp; return str_replace('g', 'г', $weight);}add_filter('woocommerce_format_weight', 'localize_weight_units');
打开App,查看更多内容
随时随地看视频慕课网APP