Commit 8b663670 authored by Fabien Potencier's avatar Fabien Potencier

merged branch lyrixx/fix-translation (PR #381)

Commits
-------

64cb149a Added a default translator.domains
c0321197 [Doc] Fixed typo in translator recipes

Discussion
----------

Fix translation

Fixed a typo in the doc + Added a default translator.domains :

If someone registers its translations via yaml, he will not provide $app['translator.domains'], so pimple will raise an exeption.

I don't know if it's better to set a default $app['translator.domains'] or to checks if it set before using it.
parents 55d7a266 64cb149a
...@@ -128,7 +128,7 @@ translation files:: ...@@ -128,7 +128,7 @@ translation files::
use Symfony\Component\Translation\Loader\YamlFileLoader; use Symfony\Component\Translation\Loader\YamlFileLoader;
$app['translator'] = $app->share($app->extend('translator', function($translator, $app) { $app['translator'] = $app->share($app->extend('translator', function($translator, $app) {
$translator->addLoader('yaml', return new YamlFileLoader()); $translator->addLoader('yaml', new YamlFileLoader());
$translator->addResource('yaml', __DIR__.'/locales/en.yml', 'en'); $translator->addResource('yaml', __DIR__.'/locales/en.yml', 'en');
$translator->addResource('yaml', __DIR__.'/locales/de.yml', 'de'); $translator->addResource('yaml', __DIR__.'/locales/de.yml', 'de');
......
...@@ -50,6 +50,8 @@ class TranslationServiceProvider implements ServiceProviderInterface ...@@ -50,6 +50,8 @@ class TranslationServiceProvider implements ServiceProviderInterface
$app['translator.message_selector'] = $app->share(function () { $app['translator.message_selector'] = $app->share(function () {
return new MessageSelector(); return new MessageSelector();
}); });
$app['translator.domains'] = array();
} }
public function boot(Application $app) public function boot(Application $app)
......
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