Skip to content

Commit

Permalink
CC-9941 Adjusted container usage
Browse files Browse the repository at this point in the history
  • Loading branch information
denis-gnusov committed Jun 30, 2020
1 parent 254be18 commit a7f15ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ public function provide(ContainerInterface $container): ContainerInterface
*/
protected function addLocale(ContainerInterface $container): ContainerInterface
{
$container[static::BC_FEATURE_FLAG_LOCALE_LISTENER] = false;
$container[static::SERVICE_LOCALE] = function (ContainerInterface $container) {
$container->set(static::BC_FEATURE_FLAG_LOCALE_LISTENER, false);
$container->set(static::SERVICE_LOCALE, function (ContainerInterface $container) {
$localeName = $this->getLocaleTransfer($container)->getLocaleName();
$this->getFactory()->getStore()->setCurrentLocale($localeName);
ApplicationEnvironment::initializeLocale($localeName);

return $localeName;
};
});

return $container;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ class LocaleApplicationPlugin extends AbstractPlugin implements ApplicationPlugi
*/
public function provide(ContainerInterface $container): ContainerInterface
{
$container[static::BC_FEATURE_FLAG_LOCALE_LISTENER] = false;
$container[static::SERVICE_LOCALE] = function (ContainerInterface $container): string {
$container->set(static::BC_FEATURE_FLAG_LOCALE_LISTENER, false);
$container->set(static::SERVICE_LOCALE, function (ContainerInterface $container): string {
$localeTransfer = $this->getFactory()->getLocalePlugin()->getLocaleTransfer($container);

$this->getFacade()->setCurrentLocale($localeTransfer);

return $localeTransfer->getLocaleName();
};
});

return $container;
}
Expand Down

0 comments on commit a7f15ff

Please sign in to comment.