Skip to content

Instantly share code, notes, and snippets.

@localheinz
Last active December 10, 2015 01:34
Show Gist options
  • Save localheinz/4359801 to your computer and use it in GitHub Desktop.
Save localheinz/4359801 to your computer and use it in GitHub Desktop.
Translation of validation error messages
<?php
/**
* Please be aware that __($messageId) is just as function that returns $messageId - it is used for gettext to pick up
* message ids.
*/
$this->inputFilter
->add(array(
'name' => 'firstname',
'validators' => array(
array(
'name' => 'NotEmpty',
'options' => array(
'messages' => array(
Validator\NotEmpty::IS_EMPTY => __('FORM_USER_FIRSTNAME_EMPTY_ERROR'),
Validator\NotEmpty::INVALID => __('FORM_USER_FIRSTNAME_INVALID_ERROR'),
),
),
),
),
))
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment