Zend Translate Zend Form!

Currently isEmpty errors throw:

Value is required and can't be empty 

I load my translator as follows:

 [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 

In the above configuration, a valid array is created according to the zend translate spec, therefore:

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

the expected result is that Empty errors should now display as

  You must specify your ID 

However, I have no love. No errors and no translations. I am on Zend 1.11.1 and PHP5.3.5.

+4
source share
3 answers

I think the problem is with the english key in your ini file. In particular, this should not be, because you are actually switching to Zend_Translate as content :

  '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 helps.

+9
source

Try to change

 content.english["isEmpty"] = "You must specify your ID" 
+2
source

you can use the user's language (MO) to easily translate it into several languages

when initializing bootstrap at the time of initialization of the selected language

0
source

Source: https://habr.com/ru/post/1340612/


All Articles