File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -846,16 +846,18 @@ of:
846846* ``\Locale::setDefault() ``;
847847* If a request is available, the ``_locale `` request attribute.
848848
849- The ``LocaleSwitcher `` service is autowireable and can be injected into other
850- services::
849+ .. code-block :: php
851850
852851 use Symfony\Component\Translation\LocaleSwitcher;
853852
854853 class SomeClass
855854 {
856- public function __construct(
857- private LocaleSwitcher $localeSwitcher,
858- ) {}
855+ private LocaleSwitcher $localeSwitcher;
856+
857+ public function __construct(LocaleSwitcher $localeSwitcher)
858+ {
859+ $this->localeSwitcher = $localeSwitcher;
860+ }
859861
860862 public function someMethod()
861863 {
@@ -883,6 +885,11 @@ services::
883885 }
884886 }
885887
888+ .. note ::
889+
890+ The class :class: `Symfony\\ Component\\ Translation\\ LocaleSwitcher ` is
891+ autowired to the ``translation.locale_switcher `` service.
892+
886893Translating Database Content
887894----------------------------
888895
You can’t perform that action at this time.
0 commit comments