This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Description
I have made routes and locale middleware with this Cookbook:
setting-locale-depending-routing-parameter.md
Now I wonder how I can pass the locale to Twig Extension which I use to create function {{ __('translate me') }}
Twig Extension is added in config/autoload/templates.global.php like this:
return [
'dependencies' => [
'factories' => [
Twig_Environment::class => TwigEnvironmentFactory::class,
TemplateRendererInterface::class => TwigRendererFactory::class,
TranslationExtension::class => TranslationExtension::class,
],
],
'templates' => [
'extension' => 'html.twig',
],
'twig' => [
'cache_dir' => 'data/cache/twig',
'assets_url' => '/',
'assets_version' => null,
'extensions' => [
// extension service names or instances
TranslationExtension::class
],
'runtime_loaders' => [
// runtime loader names or instances
],
'globals' => [
// Variables to pass to all twig templates
],
'timezone' => 'Europe/Helsinki',
],
];