S
S
Sergey Margelov2014-11-23 18:31:16
PHP
Sergey Margelov, 2014-11-23 18:31:16

How to translate two values ​​from one string?

Hello.
Faced a problem. The creators of the template did not translate it completely. There are a few untranslated pieces left. One of them is on the main page, it looks very alien.
Here is the code from the fileheader.php

<span class="cart-count">(<?php echo sprintf( _n( '%d item', '%d items', $woocommerce->cart->cart_contents_count, 'beautyspot' ), $woocommerce->cart->cart_contents_count ); ?>)</span>

The same fragment is in the file functions.php
. I added the ru_RU.pofollowing piece to the file:
#: ../header.php:57
#: ../functions.php:616
msgid "%d item"
msgstr "товаров: %d"

#: ../header.php:57
#: ../functions.php:616
msgid "%d items"
msgstr "товаров: %d"

I added translations via PoEdit so that the mo-file was updated correctly.
As a result, the value was % itemtranslated, but % itemsnot here.
I suspect this is because the values ​​are on the same line.
Tell me what am I doing wrong? How to win it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
KorsaR-ZN, 2014-11-23
@smargelov

It should be like this (read more on the wiki ):

msgid "%d item"
msgid_plural "%d items"
msgstr[0] "товаров: %d"
msgstr[1] "товаров: %d"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question