Skip to content

Commit c051d22

Browse files
committed
Restructure translatable docs
1 parent 20f68ed commit c051d22

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

translation.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,21 +304,22 @@ sure how it would be translated. For example, it could be translated multiple
304304
times if intended to be displayed to multiple users.
305305

306306
Instead of translating a string at the time of creation, a ``Translatable``
307-
object can be created that can then be translated when used::
307+
object can be created that can then be translated when used. Later this message
308+
can be translated with a translator in either PHP or in Twig.
309+
310+
PHP::
308311

309312
$message = new Translatable('Symfony is great!');
310313
$message = t('Symfony is great!');
311314

312-
Later this message can be translated with a translator in either PHP or in Twig.
313-
314-
PHP::
315-
316315
Translatable::trans($translator, $message);
317316

318317
Twig:
319318

320319
.. code-block:: html+twig
321320

321+
{% set message = t('Symfony is great!') %}
322+
322323
<h1>{{ message|trans }}</h1>
323324

324325
.. _translation-in-templates:

0 commit comments

Comments
 (0)