1

i have a function like this

public function triggerErrorMessage()
{
    $sessionCheckout = Mage::getSingleton('checkout/session');
    $sessionCheckout->addError('An error occurred during your transaction.');
}

how can i customize the text "An error occurred during your transaction" without changing the code, is this translateable in locale?

2 Answers 2

0

For magento version 1

You have to add your text in

/app/design/frontend/{my_package}/{my_theme}/locale/en_US/translate.csv

original text,changed text

More info here

you can add code as below:

$sessionCheckout->addError($this->__('An error occurred during your transaction.'));
2
  • Does it work with addError seeing as the string doesn't have localisation on it?
    – scrowler
    Commented Jun 15, 2016 at 6:19
  • Updated answer check it Commented Jun 15, 2016 at 6:29
1

No, these are not translated by default. If you search for "addError" in the core code, you will find that they always pass a translated string to the method.

If the code you showed comes from an extension, the developers apparently did not care too much about translation. You will have to change the code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.