Magento Developper Guide (Lesson 15) – Translate your Magento plugin, the Internationalization

23 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/ , is in fact the code for the language. For example the French translations will be found in /app/locale/fr_FR and the German’s will be in de_DE.

The files format is CSV and structure is as follows:

[txt]
« String to translate », « la chaine traduite »
[txt]

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.

Go to the summary of this tutorial

You should read this too :
  • No Related Post
Pebbles # 5 décembre, 2011

Boy that relaly helps me the heck out.

# 5 décembre, 2011 Pierre FAY

thanks ;) it was what i expected ^^

Sandeep # 15 décembre, 2011

Thanks dude… can I have code of this plugin??

# 15 décembre, 2011 Pierre FAY

Hi Sandeep ;) Not for the moment, but soon you will have much better. In more or less one month i will provide you a huge help for all magento developpers. I’ll in the next days insert a subscription form…you will be able suscribe and received an invitation ;)

Carma Foree # 5 janvier, 2012

Fantastic post. Sustain up the very notable performance.

# 20 novembre, 2012 Vithal Bariya

thank’s it’s amazing and very usefully .. :)

Innam Hunzai # 22 janvier, 2014

Thanks Bro …. I got everything that I want :)

Vous aussi donnez votre avis
(requis)



Expert magento sur Lille - Pierre FAY