Currently i have a knockout template for minicart like this:
<!-- ko if: getCartParam('summary_count') -->
<div class="items-total">
<!-- ko if: getCartParam('summary_count') == 1 -->
<!-- ko i18n: 'There is' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') > 1 -->
<!-- ko i18n: 'There are' --><!-- /ko -->
<!-- /ko -->
<span class="count"><!-- ko text: getCartParam('summary_count') --><!-- /ko --></span>
<!-- ko if: getCartParam('summary_count') == 1 -->
<!-- ko i18n: 'item' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') > 1 -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</div>
<!-- /ko -->
The text will generate a text like this:
There is 1 item or There are 3 items the number is the variable i get from getCartParam('summary_count')
, the problem arise when i need to translate it, for example into this:
Hanya ada 1 barang
Terdapat 2 barang
Terdapat 5 barang
Using php or phtml file i can easily translate like this:
__('There is %1 item in the cart',$item->getQty())