Commit 14edb173 authored by Fabien Potencier's avatar Fabien Potencier

merged branch lyrixx/translation (PR #498)

This PR was merged into the master branch.

Commits
-------

95a6d3db [Doc][Translation] Set local_fallback to en by default
0f7b16ca [Translation] Set local_fallback to en by default

Discussion
----------

[Translation] Set local_fallback to en by default

---------------------------------------------------------------------------

by lyrixx at 2012-09-24T17:01:23Z

Tests are ok.

---------------------------------------------------------------------------

by stof at 2012-09-24T19:01:06Z

This is wrong IMO. What about users who don't want to use a fallback locale ?

---------------------------------------------------------------------------

by lyrixx at 2012-09-24T19:36:53Z

@stof cf : https://github.com/symfony/symfony/blob/0187a1ac9497428d934f50233f43538163117c01/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php#L354
parents 7440e37c 95a6d3db
......@@ -14,7 +14,7 @@ Parameters
want to set this based on some request parameter. Defaults to ``en``.
* **locale_fallback** (optional): Fallback locale for the translator. It will
be used when the current locale has no messages set.
be used when the current locale has no messages set. Defaults to ``en``.
Services
--------
......
......@@ -31,9 +31,7 @@ class TranslationServiceProvider implements ServiceProviderInterface
$app['translator'] = $app->share(function ($app) {
$translator = new Translator($app['locale'], $app['translator.message_selector']);
if (isset($app['locale_fallback'])) {
$translator->setFallbackLocale($app['locale_fallback']);
}
$translator->addLoader('array', new ArrayLoader());
$translator->addLoader('xliff', new XliffFileLoader());
......@@ -52,6 +50,8 @@ class TranslationServiceProvider implements ServiceProviderInterface
});
$app['translator.domains'] = array();
$app['locale_fallback'] = 'en';
}
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