Skip to content

Commit a7ad43e

Browse files
[Serializer] Add TranslatableNormalizer
1 parent 5e4143e commit a7ad43e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

components/serializer.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,20 @@ The Serializer component provides several built-in normalizers:
882882
Also it can denormalize ``uuid`` or ``ulid`` strings to :class:`Symfony\\Component\\Uid\\Uuid`
883883
or :class:`Symfony\\Component\\Uid\\Ulid`. The format does not matter.
884884

885+
:class:`Symfony\\Component\\Serializer\\Normalizer\\TranslatableNormalizer`
886+
This normalizer converts objects that implement
887+
:class:`Symfony\\Contracts\\Translation\\TranslatableInterface` into
888+
translated strings, using the
889+
:method:`Symfony\\Contracts\\Translation\\TranslatableInterface::trans`
890+
method. You can define the locale to use to translate the object by
891+
setting the ``TranslatableNormalizer::NORMALIZATION_LOCALE_KEY`` serializer
892+
context option.
893+
894+
.. versionadded:: 6.4
895+
896+
The :class:`Symfony\\Component\\Serializer\\Normalizer\\TranslatableNormalizer`
897+
was introduced in Symfony 6.4.
898+
885899
.. note::
886900

887901
You can also create your own Normalizer to use another structure. Read more at

0 commit comments

Comments
 (0)