Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions translation/message_format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,21 @@ you to use literal text in the select statements:
#. Inside this block, ``{organizer_name}`` starts "code" mode again, allowing
``organizer_name`` to be processed as variable.

Additionally, it's possible to write the message directly in code::

$invitation = '{organizer_gender, select,
female {{organizer_name} has invited you for her party!}
male {{organizer_name} has invited you for his party!}
other {{organizer_name} have invited you for their party!}
}';
// prints "Ryan has invited you for his party!"
echo $translator->trans($invitation, [
'organizer_name' => 'Ryan',
'organizer_gender' => 'male',
]);

This can be used to create a wrapper.

.. tip::

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