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,
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:-
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.