Commit d7500dbd authored by Fabien Potencier's avatar Fabien Potencier

made it easier to replace the translator service with an implementation of TranslatorInterface

parent 215251cf
......@@ -72,7 +72,7 @@ class FormServiceProvider implements ServiceProviderInterface
if (isset($app['validator'])) {
$extensions[] = new FormValidatorExtension($app['validator']);
if (isset($app['translator'])) {
if (isset($app['translator']) && method_exists($app['translator'], 'addResource')) {
$r = new \ReflectionClass('Symfony\Component\Form\Form');
$app['translator']->addResource('xliff', dirname($r->getFilename()).'/Resources/translations/validators.'.$app['locale'].'.xlf', $app['locale'], 'validators');
}
......
......@@ -31,7 +31,7 @@ class ValidatorServiceProvider implements ServiceProviderInterface
$app['validator'] = function ($app) {
$r = new \ReflectionClass('Symfony\Component\Validator\Validator');
if (isset($app['translator'])) {
if (isset($app['translator']) && method_exists($app['translator'], 'addResource')) {
$app['translator']->addResource('xliff', dirname($r->getFilename()).'/Resources/translations/validators.'.$app['locale'].'.xlf', $app['locale'], 'validators');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment