Skip to content

Commit f9efd61

Browse files
committed
Merge branch '7.4' into 8.0
* 7.4: Tweaks and rewords Add Static message in doc
2 parents fa3e62b + 31bb687 commit f9efd61

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

translation.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,25 @@ 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+
Non-Translatable Messages
341+
~~~~~~~~~~~~~~~~~~~~~~~~~
342+
343+
In some cases, you may want to explicitly prevent a message from being
344+
translated. You can ensure this behavior by using the
345+
:class:`Symfony\\Component\\Translation\\StaticMessage` class::
346+
347+
use Symfony\Component\Translation\StaticMessage;
348+
349+
$message = new StaticMessage('This message will never be translated.');
350+
351+
This can be useful when rendering user-defined content or other strings
352+
that must remain exactly as given.
353+
354+
.. versionadded:: 7.4
355+
356+
The :class:`Symfony\\Component\\Translation\\StaticMessage` class was
357+
introduced in Symfony 7.4.
358+
340359
.. _translation-in-templates:
341360

342361
Translations in Templates

0 commit comments

Comments
 (0)