Skip to content

Commit

Permalink
bug #37028 [FrameworkBundle] Fix enabled_locales behavior (tgalopin)
Browse files Browse the repository at this point in the history
This PR was merged into the 5.1 branch.

Discussion
----------

[FrameworkBundle] Fix enabled_locales behavior

| Q             | A
| ------------- | ---
| Branch?       | 5.1
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

I was experimenting with enabled_locales on my application and I noticed the cache didn't actually change. It seems the generated service definition was invalid: the file `var/cache/dev/ContainerFEQLy1x/App_KernelDevDebugContainer.php` defined `getTranslator_DefaultService` by calling `new Translator` with 7 arguments instead of 6.

It seems to be due to the fact that the DI extension does not replace the right argument. With the following fix applied the behavior works as expected.

However, reading the comment of Javier in #32433, it seems he tested it against Demo and it worked with the previous code. I'm not sure why, @javiereguiluz I'd be interested in knowing if I'm missing something here :) .

Commits
-------

e2ce7f5 Fix enabled_locales behavior
  • Loading branch information
fabpot committed Jun 1, 2020
2 parents 2af156d + e2ce7f5 commit 1696f56
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -1094,7 +1094,7 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
$defaultOptions['cache_dir'] = $config['cache_dir'];
$translator->setArgument(4, $defaultOptions);

$translator->setArgument(6, $config['enabled_locales']);
$translator->setArgument(5, $config['enabled_locales']);

$container->setParameter('translator.logging', $config['logging']);
$container->setParameter('translator.default_path', $config['default_path']);
Expand Down

0 comments on commit 1696f56

Please sign in to comment.