Created
June 5, 2014 11:12
-
-
Save mikemix/8fb64c0eba7d4d4e909e to your computer and use it in GitHub Desktop.
Translator delegator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Common\Form\Delegator; | |
use Zend\ServiceManager\DelegatorFactoryInterface; | |
use Zend\ServiceManager\ServiceLocatorInterface; | |
use Zend\Validator\AbstractValidator; | |
class TranslatorDelegator | |
{ | |
public function createDelegatorWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName, $callback) | |
{ | |
/** @var \Zend\Mvc\I18n\Translator|object $translator */ | |
$translator = $callback(); | |
$translator->addTranslationFile( | |
'phpArray', | |
'./vendor/zendframework/zendframework/resources/languages/pl/Zend_Validate.php' | |
); | |
AbstractValidator::setDefaultTranslator($translator); | |
return $translator; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment