Magento Developper Guide (Lesson 15) – Translate your Magento plugin, the Internationalization23 novembre 2011
This tutorial is the 15th of many tutorials . If you have not read the first articles yet, I strongly advise you to do so.
As you know the websites are often translated into several languages, this plugin was not translated from one language to another, it is now time to get started.
On Magento, you will find translations in folder/app/locale/
The files format is CSV and structure is as follows:
« String to translate », « la chaine traduite »
Files must be declared in your config.xml plugin:
<translate> <modules> <Pfay_Test> <files> <default>Pfay_Test.csv</default> </files> </Pfay_Test> </modules> </translate>
Now when you want to translate your string, use:
<?php echo $this->__('String to translate'); ?> //result: la chaine traduite
Magento will search for the corresponding translation to your chain in your csv file. if you are in French, it will search the correspondence in the file/app/locale/fr_FR/Pfay_Test.csv, then he will find the string « String to translate » and return « la chaine traduite. »
I hope it will helps.