Hi, Translations doesn't work with AJAX.
Example: This code produces standard validators messages $response = $form->processAjax($form->getValues()); $this->getResponse()->setHeader('Content-Type', 'application/json') ->setBody($response); This code populates messages from translator file $form->isValid($this->_request->getPost()); I think you should extend method: Zend_Form::public function processAjax(array $data) { require_once 'Zend/Json.php'; if ($this->isValidPartial($data)) { return Zend_Json::encode(true); } $messages = $this->getMessages(); // put translation here ;) return Zend_Json::encode($messages); } regards, Łukasz On 03/02/2008, Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote: > > -- Dividy <[EMAIL PROTECTED]> wrote > (on Saturday, 02 February 2008, 03:19 PM -0800): > > For my first post on this nice forum, could someone explain me in > details > > how to translate the error messages of a zend_form validation ? > > > > I tried much thing but none work. > > You'll need to do several things. > > First, for each validator you use, determine what the various error > codes are -- you can do this by looking at the values of the validator's > class constants. For instance, 'Zend_Validate_NotEmpty' defines the > constant Zend_Validate_NotEmpty::STRING_EMPTY to 'stringEmpty'. > > Armed with that list, create translations for one of the translation > adapters supported by Zend_Translate. If you were using, for instance, > the 'array' adapter, you could do this: > > <?php > // translations.php > return array( > 'stringEmpty' => 'Please fill in this value', > ... > ); > > Then, create your translate object: > > $translations = include 'path/to/translations.php'; > $translate = new Zend_Translate('array', $translations, 'en'); > > And pass the translation adapter to your form: > > $form->setTranslator($translate->getAdapter()); > > And that's all there is to it. The above defines english translations, > but you can do whatever language you want; refer to the Zend_Translate > manual for more information on creating these. > >