diff --git a/translation.rst b/translation.rst index ed656c62848..d3042356b8e 100644 --- a/translation.rst +++ b/translation.rst @@ -337,6 +337,19 @@ Templates are now much simpler because you can pass translatable objects to the There's also a :ref:`function called t() `, available both in Twig and PHP, as a shortcut to create translatable objects. +On the contrary, if you want your message to never be translated, you can +ensure this behavior with the +:class:`Symfony\\Component\\Translation\\StaticMessage` class:: + + use Symfony\Component\Translation\StaticMessage; + + $message = new StaticMessage('This message will never be translated.'); + +.. versionadded:: 7.4 + + The :class:`Symfony\\Component\\Translation\\StaticMessage` class was introduced in Symfony + 7.4. + .. _translation-in-templates: Translations in Templates