Search code examples
magentomagento-1.9

Magento custom language file not being used


I have created a custom language file for a feature that I have built into our Magento website. The language variables work fine on my local machine (of course), however on our staging environment it doesn't. My local machine is Windows and staging server is Linux, so obvious answer would be an issue with filename casing, but imho these are right.

I have my own block that overwrites the Mage_Catalog, called Feno_Catalog which works fine. To that config.xml file I've appended some code to load the Feno_Catalog.csv;

/local/Feno/Catalog/etc/config.xml:

<?xml version="1.0" encoding="iso-8859-1"?>
<config>
    <modules>
        <Feno_Catalog>
            <version>0.1.0</version>
        </Feno_Catalog>
    </modules>
    <global>
        <blocks>
            <catalog>
                <rewrite>
                    <class>Feno_Catalog_Block</class>
                </rewrite>
            </catalog>
        </blocks>
        <helpers>
            <catalog>
                <rewrite>
                    <class>Feno_Catalog_Helper</class>
                </rewrite>
            </catalog>
        </helpers>
    </global>
    <frontend>
        <translate>
            <modules>
                <Feno_Catalog>
                    <files>
                        <default>Feno_Catalog.csv</default>
                    </files>
                </Feno_Catalog>
            </modules>
        </translate>
    </frontend>
    <adminhtml>
        <translate>
            <modules>
                <Feno_Catalog>
                    <files>
                        <default>Feno_Catalog.csv</default>
                    </files>
                </Feno_Catalog>
            </modules>
        </translate>
    </adminhtml>
</config>

The CSV file has been put into 2 folders: /app/locale/[de_DE|en_US]/ with matching casing.

As I mentioned it works fine on my local machine, but not on the staging server. What could cause this? I've searched for quite a bit and cleared cache (although cache is turned off), switched languages (both languages don't work - The language keys are like "poll_question_a1").

When I move the translations to Mage_Catalog.csv everything also works fine (but of course that is not what I want).

So how to fix? Is there any way to find the cause of this?


Solution

  • Perhaps since you're rewriting the catalog module, you need your translates to look like this:

    <translate>
        <modules>
            <Mage_Catalog>
                <files>
                    <feno>Feno_Catalog.csv</feno> <!-- name it something other than default, to avoid conflict with Mage_Catalog -->
                </files>
            </Mage_Catalog>
        </modules>
    </translate>
    

    Also, you can try looking in app/code/core/Mage/Core/Model/Translate.php around line 131-134. That is where it is loading your module translations. Try doing some Mage::log() calls in and around there to see if your CSV files are actually getting loaded.