Magento 1.9 Coupon Code Translation Not Working – Fix Guide

localisationmagento-1.9

In /app/code/core/Mage/Checkout/controllers/CartController.php I see:

$this->_getSession()->addError(
    $this->__(
       'Coupon code "%s" is not valid.',
        Mage::helper('core')->escapeHtml($couponCode)
    )
);

In my theme's translate.csv I have added:

"Mage_Checkout::Coupon code ""%s"" was applied.","test"
"Coupon code ""%s"" is not valid.","test"

If I edit the controller code directly, it works. The translate.csv does not work — it still outputs the original text, 'Coupon code "blah" is not valid.'.

I even tried editing the translation in app/locale/en_US/Mage_Checkout.csv but it didn't work either.

What have I missed? Shouldn't it be outputting "test" ??

Best Answer

To be sure, you should add the translation scope (i.e. the module name) to both translations:

"Mage_Checkout::Coupon code ""%s"" was applied.","test"
"Mage_Checkout::Coupon code ""%s"" is not valid.","test"

Don't forget to clean the cache after changing translations.