Skip to content

[Translation] Extract locale fallback computation into a dedicated class #45553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: 7.4
Choose a base branch
from
Prev Previous commit
Next Next commit
Try to get away without requirement bumps in FrameworkBundle
  • Loading branch information
mpdude committed Feb 28, 2022
commit 47fe72ae82cf82699c1ef7224f431d1b5dc4b87e
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
'debug' => param('kernel.debug'),
],
abstract_arg('enabled locales'),
service('translation.fallback_locale_provider')
service('translation.fallback_locale_provider')->ignoreOnInvalid(),
])
->call('setConfigCacheFactory', [service('config_cache_factory')])
->tag('kernel.locale_aware')
Expand All @@ -78,9 +78,6 @@
->set('translator.formatter.default', MessageFormatter::class)
->args([service('identity_translator')])

->set('translation.fallback_locale_provider', FallbackLocaleProvider::class)
->alias(FallbackLocaleProviderInterface::class, 'translation.fallback_locale_provider')

->set('translation.loader.php', PhpFileLoader::class)
->tag('translation.loader', ['alias' => 'php'])

Expand Down Expand Up @@ -169,4 +166,10 @@
->tag('container.service_subscriber', ['id' => 'translator'])
->tag('kernel.cache_warmer')
;

if (class_exists(FallbackLocaleProvider::class)) {
$container->services()
->set('translation.fallback_locale_provider', FallbackLocaleProvider::class)
->alias(FallbackLocaleProviderInterface::class, 'translation.fallback_locale_provider');
}
};