Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Zend Framework (http://framework.zend.com/)
- *
- * @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
- * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
- namespace Application;
- use Zend\Mvc\ModuleRouteListener;
- use Zend\Mvc\MvcEvent;
- use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
- use Zend\ModuleManager\Feature\ConfigProviderInterface;
- use Zend\ModuleManager\Feature\ServiceProviderInterface;
- use Zend\Validator\AbstractValidator;
- class Module implements AutoloaderProviderInterface, ConfigProviderInterface , ServiceProviderInterface
- {
- public function onBootstrap(MvcEvent $e)
- {
- // Configuração de Internacionalização
- $app = $e->getApplication();
- $eventManager = $app->getEventManager();
- $eventManager->attach('dispatch',
- function($e){
- $routeMatch = $e->getRouteMatch();
- if ($routeMatch->getParam('lang') != '')
- {
- $this->serviceManager = $e->getApplication()->getServiceManager();
- $translator = $this->serviceManager->get('translator');
- $translator->setLocale($routeMatch->getParam('lang'));
- // $translator->addTranslationFile('phpArray', __DIR__.'/../../vendor/zendframework/zend-i18n-resources/languages/en/Zend_Validate.php', 'default', 'en_US');
- $translator->addTranslationFile('phpArray', __DIR__.'/../../vendor/zendframework/zend-i18n-resources/languages/pt_BR/Zend_Validate.php', 'default', 'pt_BR');
- AbstractValidator::setDefaultTranslator($translator);
- }
- }, 100
- );
- $moduleRouteListener = new ModuleRouteListener();
- $moduleRouteListener->attach($eventManager);
- }
- public function getConfig()
- {
- return include __DIR__ . '/config/module.config.php';
- }
- public function getServiceConfig()
- {
- // return array(
- // 'controllers' => array(
- // 'factories' => array(
- // 'Application\Controllers\Correspondencias' => function($sm)
- // {
- // var_dump($sm);
- // $translator = $sm->getServiceLocator()->get('translator');
- // $controller = new Application\Controller\CorrespondenciasController($translator);
- // }
- // )
- // )
- // );
- }
- public function getAutoloaderConfig()
- {
- return array(
- 'Zend\Loader\StandardAutoloader' => array(
- 'namespaces' => array(
- __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
- ),
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement