Magento - how to translate message type

532 views Asked by At

How do I translate the message type that is displayed to the user when adding product to cart?

The message itself is translated, but the message heading, "Success" is not. So for the French version of my site, the message is:

"Success!

Glacière Nomad Extreme 55 L a été ajouté à votre panier."

It should read "Succès!".

I have tried adding the translation to my own translate.csv, as well as the file in "app/locale/fr_FR".

I also tried enabling inline translation, but when viewing the page, the word Success is not translatable.

If I look at the class "Message" (/app/code/core/Mage/Core/Model/Message.php), I can see a const:

const SUCCESS   = 'success';

I believe it is this text that is being used as the message type, and therefore, is not translatable.

Any ideas how to translate this?

1

There are 1 answers

0
mattf10 On BEST ANSWER

I solved this by wrapping

$message->getType()

in the translatable text output, like so:

echo $this->__($message->getType());

For some reason, I don't need to do this for $message->getCode(), where the text is being translated somewhere else.