cancel
Showing results for 
Search instead for 
Did you mean: 

Blank translation in custom admin module using helper

SOLVED

Blank translation in custom admin module using helper

I added the nodes in config.xml;

<global>
<helpers>
            <custommodule>
                <class>NameSpace_CustomModule_Helper</class>
            </custommodule>
        </helpers>
</global>
<adminhtml>
        <translate>
            <modules>
                <custommodule>
                    <files>
                        <default>NameSpace_CustomModule.csv</default>
                    </files>
                </custommodule>
            </modules>
        </translate>
    </adminhtml>

I created de Data.php in Helper folder; I added the NameSpace_CustomModule.csv in folder locale/en_US/

"Translate this","Translate this"

And in php into Block folder in added:

 $fieldset->addField('simple_action', 'select', array(
        'label'     => Mage::helper('salesrule')->__('Apply'),
        'name'      => 'simple_action',
        'options'    => array(
            Mage_SalesRule_Model_Rule::BY_PERCENT_ACTION => Mage::helper('salesrule')->__('Percent of product price discount'),
            Mage_SalesRule_Model_Rule::BY_FIXED_ACTION => Mage::helper('salesrule')->__('Fixed amount discount'),
            Mage_SalesRule_Model_Rule::CART_FIXED_ACTION => Mage::helper('salesrule')->__('Fixed amount discount for whole cart'),
            Mage_SalesRule_Model_Rule::BUY_X_GET_Y_ACTION => Mage::helper('salesrule')->__('Buy X get Y free (discount amount is Y)'),
            NameSpace_CustomModule_Model_Rule::FINAL_PRICE_ACTION => Mage::helper('custommodule')->__('Translate this'),

        ),
    ));

But the dropdown is blank.

If I delete the adminhtml> translate node, the text appears. So I guess the problem is with reading in csv.

Already replaces the custommodule node within adminhtml> translate> module for NameSpace_CustomModule, namespace_custommodule e CustomModule but there was no difference.

Not show errors in log archive.

I'm not identifying any kind of error, it should work.

 

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Blank translation in custom admin module using helper

The problem was quite stupid! After trying the asrarau hint, delete the .csv files to see if it even appeared without the translation. When creating again I realized that I could not put special characters in .csv. The solution was to use a Latin converter for UTF-8.

 

Thanks a lot for the help.

View solution in original post

5 REPLIES 5

Re: Blank translation in custom admin module using helper

Hi @lhardrex,

 

Can you change this section?

 

    <adminhtml>
        <translate>
            <modules>
                <NameSpace_CustomModule>
                    <files>
                        <default>NameSpace_CustomModule.csv</default>
                    </files>
                </NameSpace_CustomModule>
            </modules>
        </translate>
    </adminhtml>

 

Re: Blank translation in custom admin module using helper

Yes, i changed to NameSpace_CustomModule, namespace_custommodule, custommodule and CustomModule. Always without execute translate

Re: Blank translation in custom admin module using helper

Hi,

 

Try changing you helper from 'sales rule' to your helper 'custom helper' in Mage::helper('salesrule')->__('Percent of product price discount')

Re: Blank translation in custom admin module using helper

The problem was quite stupid! After trying the asrarau hint, delete the .csv files to see if it even appeared without the translation. When creating again I realized that I could not put special characters in .csv. The solution was to use a Latin converter for UTF-8.

 

Thanks a lot for the help.

Re: Blank translation in custom admin module using helper

ha that’s a nifty one!