Magento Translations Module

One of best things in magento is you can easily add new language versions to the site. It's all done using CSV files - 1 file for 1 module per language. For most popular languages translations are available as free Magento modules on magento connect.

What if we want to change the translations and don't lose changes after updating magento and translations? Or if we want to have translation common independently of module? Or just list all the texts that were added by us and are not original magento texts? We can create our own very simple translations module.

You need to edit only 2 files:

  • etc/config.xml
    <?xml version="1.0"?>

  • and helper/data.php:
    class Baobaz_Translations_Helper_Data extends Mage_Core_Helper_Abstract


and that's it... Module must be turned on (in etc/modules) and it will work fine.

in app/locale/fr_fr/ we create file Baobaz_Translations.csv and in it we put all the new translations we need.

Then, anywhere in magento - doesn't matter if it's template, block or controller - we can use:

echo Mage::helper('translations')->__('text to translate');

Yes. It is that simple.

3 comments on "Magento Translations Module"

evuska's picture
evuska (visitor) - Fri, 13/11/2009 - 14:28:

Great, great!

Thank you so much!!

Pedro's picture
Pedro (visitor) - Tue, 18/05/2010 - 19:13:

Thanks for this will help to translate custom themes to portuguese. Just one question, what's the path for helper/data.php? Can it be in the theme's files?


Paul Web's picture
Paul Web (visitor) - Wed, 30/03/2011 - 04:53:

Thanks for putting this out, it is simple (or at least more simple than I had imagined it would be.) You've saved me hours of head-scratching, cheers!