No doubt you will be familiar with Magento’s translate.csv file in your local theme. You can use it to override whatever default translation strings you want to change by entering a value pair like so:
"Original Text String","Customized Text String"
However, what if the same original text appears in several different Magento modules and you only want to change the ones in a specific module?
For example, the Mage_Checkout.csv contains the strings for the shopping cart page. There, we have the cart table column headings such as “Product Name”, “Qty”, etc. Say, we want to change the “Product Name” to “Items in Your Cart”. A quick search for “Product Name” in the translation files shows that it appears in a lot of places.
Traditionally, the only way to deal with this is to override the cart.phtml file and replace the strings directly in there or to use inline translations. However, a little known Magento feature of the translation module allows us to target strings from a specific module by using the module name as part of the translation key.
All we need to do in our translate.csv file is:
"Mage_Module::Original Text String","Customized Text String"
So in our “Product Name” example this would be:
"Mage_Checkout::Product Name","Items in Your Cart"
Simple trick, but effective.
Originally published on magebase.com. Copyright © 2011 Magebase - All Rights Reserved.