| @@ 8-22 (lines=15) @@ | ||
| 5 | use Pimple\Container; |
|
| 6 | use Pimple\ServiceProviderInterface; |
|
| 7 | ||
| 8 | final class IsoCodesValidatorServiceProvider implements ServiceProviderInterface |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * {@inheritdoc} |
|
| 12 | */ |
|
| 13 | public function register(Container $pimple) |
|
| 14 | { |
|
| 15 | if (isset($pimple['translator'])) { |
|
| 16 | $file = __DIR__.'/../../Resources/translations/validators.'.$pimple['locale'].'.xlf'; |
|
| 17 | if (file_exists($file)) { |
|
| 18 | $pimple['translator']->addResource('xliff', $file, $pimple['locale'], 'validators'); |
|
| 19 | } |
|
| 20 | } |
|
| 21 | } |
|
| 22 | } |
|
| 23 | ||
| @@ 11-32 (lines=22) @@ | ||
| 8 | /** |
|
| 9 | * @author Sullivan Senechal <[email protected]> |
|
| 10 | */ |
|
| 11 | class IsoCodesValidatorSilex1ServiceProvider implements ServiceProviderInterface |
|
| 12 | { |
|
| 13 | /** |
|
| 14 | * {@inheritdoc} |
|
| 15 | */ |
|
| 16 | public function register(Application $app) |
|
| 17 | { |
|
| 18 | if (isset($app['translator'])) { |
|
| 19 | $file = __DIR__.'/../../Resources/translations/validators.'.$app['locale'].'.xlf'; |
|
| 20 | if (file_exists($file)) { |
|
| 21 | $app['translator']->addResource('xliff', $file, $app['locale'], 'validators'); |
|
| 22 | } |
|
| 23 | } |
|
| 24 | } |
|
| 25 | ||
| 26 | /** |
|
| 27 | * {@inheritdoc} |
|
| 28 | */ |
|
| 29 | public function boot(Application $app) |
|
| 30 | { |
|
| 31 | } |
|
| 32 | } |
|
| 33 | ||