Dear my friends, last post I wrote about “How to create a multiple language website in Magento“, now I’ll continue with a related topic “How to create language packages for an extension in Magento”.

In this topic, I’ll use our FAQ extension as a real example.

    • Step 1: Edit config.xm file in : your_module/etc/config.xml
      Find section and add below piece of code:

      
      <translate>
                  <modules>
                      <Magestore_Faq>
                          <files>
                              <default>Magestore_Faq.csv</default>
                          </files>
                      </Magestore_Faq>
                  </modules>
              </translate>
      

      You need to change the namespace and module name to suit with your need.

    • Step 2: Use a standard way to show text in your code
      In your .phtml code, you need to show the text in $this->(“”) function. For example:

      
      <h3><?php echo $this->__('FAQ Search Results');?></h3>
      
      
    • Step 3: Create a CSV file for language package
      In my extension, I created: Magestore_Faq.csv then put in app/locale/language_folder (such as: en_US or fr_FR)

      
      "FAQ","FAQ"
      "FAQ Topics","FAQ Topics"
      "Most Frequently Asked Questions","Most Frequently Asked Questions"
      "FAQ Categories","FAQ Categories"
      "Category","Category"
      "Search FAQ","Search FAQ"
      "FAQ Search Results","FAQ Search Results"
      "Keywords","Keywords"
      "Matches","Matches"
      "Other Answers in the Category","Other Answers in the Category"
      "Answers in the Category","Answers in the Category"
      "Search","Search"
      
      

Now it’s time to see how it work!

Author

Why Magestore? We believe in building a meaningful & long-term relationship with you.

1 Comment

Write A Comment