Hi Andreas,
currently I use this code in a ListenerAggregate class to add the
translations for validators:
$baseDir = APPLICATION_ROOT . '/module/Application/language';
$translator = Translator::factory(array(
'locale' => 'de',
'translation_file_patterns' => array(
array(
'type' => 'phpArray',
'base_dir' => $baseDir,
'pattern' => 'Zend_Validate.php',
'text_domain' => 'default',
),
)
));
AbstractValidator::setDefaultTranslator($translator);
The Zend_Validate.php file is the one from the /resources path within
the ZF2 installation under /vendor. It is quite handy just to copy the
needed translation files for all validators.
The problem I see with your gist is that I need to set the messages for
every validator I usw. With AbstractValidator::setDefaultTranslator() I
can set it a central point and I only need to overwrite such messages
which are to technical and hard to understand for end users.
Regards,
Ralf
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]