Zend Framework set on bootstrap.php custom locale -
how set custom locale in zend framework create function in bootstrap file? need change error messege in zend form.
thanks support
you can use code set locale
// within bootstrap $locale = new zend_locale('de_at'); zend_registry::set('zend_locale', $locale); // within model or controller $date = new zend_date(); print $date->getlocale(); echo $date->getdate(); more info on zend_locale
for adding translated error message form validators have add them zend_validate_abstract
from zf manual
zend framework shipped more 45 different validators more 200 failure messages. can tedious task translate of these messages. convenience zend framework comes pre-translated validation messages. can find them within path /resources/languages in zend framework installation. translate validation messages german example, have attach translator zend_validate using these resource files.
$translator = new zend_translate( 'array', '/resources/languages', $language, array('scan' => zend_locale::locale_directory) ); zend_validate_abstract::setdefaulttranslator($translator); more info on validator error message in manual using pre-translated validation messages
i havent used translation adaptors, manual creating csv source files translation seems below code add translator application
$translate = new zend_translate( array( 'adapter' => 'csv', 'content' => '/path/to/mytranslation.csv', 'locale' => 'de' ) ); also sample of .csv format
message1;nachricht1
message2;nachricht2
Comments
Post a Comment