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:
846
846
* ``\Locale::setDefault() ``;
847
847
* If a request is available, the ``_locale `` request attribute.
848
848
849
- The ``LocaleSwitcher `` service is autowireable and can be injected into other
850
- services::
849
+ .. code-block :: php
851
850
852
851
use Symfony\Component\Translation\LocaleSwitcher;
853
852
854
853
class SomeClass
855
854
{
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
+ }
859
861
860
862
public function someMethod()
861
863
{
@@ -883,6 +885,11 @@ services::
883
885
}
884
886
}
885
887
888
+ .. note ::
889
+
890
+ The class :class: `Symfony\\ Component\\ Translation\\ LocaleSwitcher ` is
891
+ autowired to the ``translation.locale_switcher `` service.
892
+
886
893
Translating Database Content
887
894
----------------------------
888
895
You can’t perform that action at this time.
0 commit comments