Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zend Translate Zend Form!

Currently, isEmpty errors throw:

    Value is required and can't be empty

I'm loading my translator up like this:

[translation]

adapter = array
content.english["emailNotUnique"] = "Your user already exists"
content.english["Value is required and can't be empty"] = "You must specify your ID"
locale = en

The config above produces a valid array according to zend translate spec, so:

$this -> form -> setTranslator(new Zend_Translate($this -> getConfig() -> translation));

expected result is that isEmpty errors should now show up as

    You must specify your ID

However I'm getting no love. No errors and no translation. I'm on Zend 1.11.1 and PHP5.3.5.

like image 646
jhogendorn Avatar asked Dec 21 '22 17:12

jhogendorn


1 Answers

I think that the problem is with english key in your ini file. Specifically it should not be there, because what you are actually passing to Zend_Translate as a content is:

    'content' => array(
        'english' => array(
            "emailNotUnique" => 'Your user already exists' ,
            "Value is required and can't be empty" => 'You must specify your ID' 
        )            
    );

And it should be:

    'content' => array(          
            "emailNotUnique" => 'Your user already exists' ,
            "Value is required and can't be empty" => 'You must specify your ID'             
    );

Hope this will help.

like image 140
Marcin Avatar answered Jan 10 '23 13:01

Marcin