9

Create a simple translation module in Magento

Magento has a powerful translation system, but what if we want change the translation without touching the original files of Magento ? the best solution is creating a translation module.

First, create a module in app/code/local/[CompanyName]/Translations
create file: etc/config.xml with content:

create file: Helper/Data.php with content:

create file: app/etc/modules/CompanyName_All.xml with content:

now you can add translation files in app/locale/[Language]/ with filename: CompanyName_Translations.csv
the translation text is like:
“good morning”,”bonjour”

now you can use this translation helper in template files:

Darktalker

9 Comments

  1. Hi,
    I try to apply this to my magento but it doesn’y work.

    The error is the follow:
    Fatal error: Class ‘Mage_Translations_Helper_Data’ not found in app/Mage.php on line 520

    I created my Htt_Translations_Helper_Data but
    It seems that magento looking for another data class beginning with “Mage_” instead of “Htt_”

    Can you help me?

    Kind regards

  2. Hi,

    i’ve got the same problem as Sandro. It can’t find the Data Class because it searchs for “Mage_MyModuleName…”

    Any hints?

    thanks

  3. So, ok i fixed my problem. I didnt declare the helper in my config.xml…
    Like this:

    MyNamespace_Mymodule_Helper

  4. grate! I just noticed your comment, if you need any help, just leave a comment 🙂

  5. codepool has to be written codePool
    to avoid:
    Fatal error: Class ‘Mage_Translations_Helper_Data’ not found in app/Mage.php on line 520

  6. Please change “codepool” to “codePool”, otherwise others will also loose a lot of time to find out why it doesn’t work…

    Thank you!

  7. I changed to another code hightlighter, the uppercases should be kept correctly.

Leave a Reply