Skip to content

Commit 6d52e05

Browse files
committed
add review suggestions
1 parent 4c023af commit 6d52e05

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

translation.rst

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff 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+
886893
Translating Database Content
887894
----------------------------
888895

0 commit comments

Comments
 (0)