Skip to content

Commit 369c662

Browse files
committed
minor #21245 Add Static message in doc (VincentLanglet)
This PR was squashed before being merged into the 7.4 branch. Discussion ---------- Add Static message in doc Closes #21239 Commits ------- 48f8eee Add Static message in doc
2 parents 44eb52f + 48f8eee commit 369c662

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

translation.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,19 @@ Templates are now much simpler because you can pass translatable objects to the
337337
There's also a :ref:`function called t() <reference-twig-function-t>`,
338338
available both in Twig and PHP, as a shortcut to create translatable objects.
339339

340+
On the contrary, if you want your message to never be translated, you can
341+
ensure this behavior with the
342+
:class:`Symfony\\Component\\Translation\\StaticMessage` class::
343+
344+
use Symfony\Component\Translation\StaticMessage;
345+
346+
$message = new StaticMessage('This message will never be translated.');
347+
348+
.. versionadded:: 7.4
349+
350+
The :class:`Symfony\\Component\\Translation\\StaticMessage` class was introduced in Symfony
351+
7.4.
352+
340353
.. _translation-in-templates:
341354

342355
Translations in Templates

0 commit comments

Comments
 (0)