How to translate the cart texts like "2 items" etc.

Have added a translate.csv file in my template and tried to add the following, but they do not get translated:
You have <a href="%s">
items</a> in your cart.
You have <a href="%s">1 item</a> in your cart.

Have found the file that generates the translated text in app/design/frontend/default/jm_hawkstore/template/jmajaxcart:
<p class="amount"><?php echo $this->__(‘You have <a href="%s">1 item</a> in your cart.’, $this->getUrl(‘checkout/cart’)) ?></p>

<p class="amount"><?php echo $this->__(‘You have <a href="%s">’.count($_items).’ items</a> in your cart.’, $this->getUrl(‘checkout/cart’), $_cartQty) ?></p>

If I hardcode translate the text it get translated correct.

Also in the ajax cart at the top it says "X items". Where and what should I write to translate it? Have tried to add "%s items" but it doesn’t get translated.

Also the text QTY next to the quantity field I cannot find where to translate.

Notice: I can’t just hardcode translate it as our site is in 5 different languages.

Thank you

  1. Profile photo of sadra.hosadra.ho 220.00 $tone December 17, 2014
    Hi, can I ask how you resolved this? I have the same issue.

11 answers

Profile photo of Seoki Lee 1510.00 $tone September 15, 2014

To translate text "items", you can edit file app\code\local\Wavethemes\Jmquickbuy\controllers\I ndexController.php, about line 186, find and replace this rule:


echo Mage::getSingleton('checkout/session')->getQuote()->getItemsSummaryQty().' items';



echo Mage::getSingleton('checkout/session')->getQuote()->getItemsSummaryQty().$this->__(' items');
Profile photo of Lars Nielsen 170.00 $tone September 16, 2014

Don’t know if you corrected this for me because the code is already displaying as you suggest. Have added the ‘ items’ in the translate.csv for my theme and cleared cache, but it doesn’t load. Also the text "You have <a href="%s">" "items</a> in your cart." is not translated anymore.

In the attached image you will see me translate.csv file
Attachment 40004


Please login or Register to Submit Answer

Written By