M
M
Miracle_Coder2018-05-02 20:38:11
WooCommerce
Miracle_Coder, 2018-05-02 20:38:11

How to translate the number of products in Wordpress?

There is a site https://mixmobile24.ru/shop/. Under each product picture there is a number of products. You need to translate "items" into Russian. I fight all day. I can't figure out how to do it. In the admin panel, if you go to this page, it's completely empty. Found a shortcode

if ( ! is_wp_error( $terms ) && $terms ) {
          $category             = $terms[0];
          $term_id              = $category->term_id;
          $thumbnail_id         = absint( get_woocommerce_term_meta( $term_id, 'thumbnail_id', true ) );
          $small_thumbnail_size = apply_filters( 'martfury_category_box_thumbnail_size', 'shop_catalog' );

          $image_html = '';
          if ( $thumbnail_id ) {
            $image_html = martfury_get_image_html( $thumbnail_id, $small_thumbnail_size );
          }

          $count = $category->count;


          $item_text = esc_html__( 'items', 'martfury' );
          if ( $count <= 1 ) {
            $item_text = esc_html__( 'item', 'martfury' );
          }

          $count .= ' ' . apply_filters( 'martfury_category_box_items_text', $item_text, $count );


          $term_list[] = sprintf(
            '<div class="%s col-cat"><a class="term-item" href="%s">%s <h3 class="term-name">%s <span class="count">%s</span></h3></a></div>',
            esc_attr( $classes ),
            esc_url( get_term_link( $term_id, 'product_cat' ) ),
            $image_html,
            $category->name,
            $count
          );
        }

But if you change "items" to something else there, or even delete this piece, nothing on the site changes. Please help what to do about it? SOS!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pychev Anatoly, 2018-05-02
@Miracle_Coder

You have the esc_html__ translator function there, so look for the translation in the translation files.
These are files of type ххххх-ru_RU.po and ххххх-ru_RU.mo They are opened by the poedit program. After editing, be sure to generate a file with the .mo extension and replace the previous one. And I think everything will fall into place.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question