Hy interested ones,
many of you are using validators within Zend Framework.
As you know the returned error messages can be changed. This is very important for sites which are not delivered in english.
But they must translate all messages into their own language. This is a very tendious task.
Therefor I added today a new feature to Zend Framework. In fact it’s not really a new issue but more a long outstanding work :-)
Zend Framework comes now with translation resources.
These are pre-translated validation messages which are shipped as with release 1.10.
To use them you can simply do the following in your bootstrap:
$translator = new Zend_Translate( 'array', '/resources/languages', $language, array('scan' => Zend_Translate::LOCALE_DIRECTORY) ); Zend_Validate_Abstract::setDefaultTranslator($translator);
When $language would be “de” all validation message are returned in german.
This should save you a lot of work for your project.
Note that the resources are outside the ‘/library’ path.
And you can also change the existing resources to do your own translations.
This is much simpler and faster than creating a new translation file manually.
For more informations take a look into Zend Frameworks manual.
I hope you find this feature useful and
have fun with Zend Framework,
I18N Team Leader, Zend Framework
Zend Framework Advisory Board Member
Zend Certified Engineer for Zend Framework