Home » Magento30 July 2012

Magento: Language Translation for Custom Module [Step-by-Step Guide]

This article shows how you can create and use custom language translation csv file for your custom module. Suppose, I have created a new module and I want language translation file particularly for my newly made module. Here is how we do it:-

In this example,

Namespace: Chapagain
Module Name: News

1) In config.xml file of your module, you have to write the following code specifying the language translation csv file.

Note that the same code is written inside the frontend and adminhtml node. Frontend is for frontend translation and adminhtml is for backend translation. In the example below, same file name (Chapagain_News.csv) is specified for both. You may use different file as well.

2) You have to create a new file inside app/locale/LANGUAGE_CODE. By default, the LANGUAGE_CODE is en_US. The file name should be Chapagain_News.csv.

Open the file and write the following:-

csv file

3) Open template file of your module. In this case, the template file will be like app/design/frontend/default/default/template/news/new.phtml.

Write the following in the template file:-

4) Clear Cache (System -> Cache Management)

5) Browse your module. Suppose, your magento installation is in example.com, then your module URL might be like http://example.com/news

You should see ‘Magento’ instead of ‘PHP’.

Finally, you have a custom language translation file for your custom module.



Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • Magento Modules

    Sounds good, so far getting some errors related to template file, but will get them fixed..

    Magento Modules

  • Miha

    Thanks. It works for CSV translations but I’m unable to get inline translations to work ..

  • Pingback: inline translation not working in magento - How-To Video()

  • Nilo César Teixeira

    Thanks for this idea, telling my custom module to translate from another csv was great and worked perfectly.