Skip to content

Commit a490d10

Browse files
someonewithpcjaviereguiluz
authored andcommitted
Add documentation for pull #37371
1 parent 61b3221 commit a490d10

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

translation/message_format.rst

+15
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,21 @@ you to use literal text in the select statements:
165165
#. Inside this block, ``{organizer_name}`` starts "code" mode again, allowing
166166
``organizer_name`` to be processed as variable.
167167

168+
Additionally, it's possible to write the message directly in code::
169+
170+
$invitation = '{organizer_gender, select,
171+
female {{organizer_name} has invited you for her party!}
172+
male {{organizer_name} has invited you for his party!}
173+
other {{organizer_name} have invited you for their party!}
174+
}';
175+
// prints "Ryan has invited you for his party!"
176+
echo $translator->trans($invitation, [
177+
'organizer_name' => 'Ryan',
178+
'organizer_gender' => 'male',
179+
]);
180+
181+
This can be used to create a wrapper.
182+
168183
.. tip::
169184

170185
While it might seem more logical to only put ``her``, ``his`` or ``their``

0 commit comments

Comments
 (0)