Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
<?php
return [
// the following assumes that you are using composer
// and that your main application entrance point (i.e. public/index.php) changes the working directory
// to the one containing the 'vendor' dir, like in ZendSkeletonApplication.
'translator' => [
'locale' => 'it',
'translation_file_patterns' => [
[
'type' => 'phpArray',
'base_dir' => 'vendor/zendframework/zendframework/resources/languages',
'pattern' => '%s/Zend_Captcha.php',
'text_domain' => 'zend_validate',
],
[
'type' => 'phpArray',
'base_dir' => 'vendor/zendframework/zendframework/resources/languages',
'pattern' => '%s/Zend_Validate.php',
'text_domain' => 'zend_validate',
]
],
],
];
<?php
namespace Application;
use Zend\Mvc\MvcEvent;
use Zend\Validator\AbstractValidator;
class Module
{
public function onBootstrap(MvcEvent $event)
{
$application = $event->getApplication();
$serviceManager = $application->getServiceManager();
$translator = $serviceManager->get('translator');
AbstractValidator::setDefaultTranslator($translator, 'zend_validate');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment