From 5f26e1ed153417a203ba8ef06d9531255c52b3ba Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Sun, 21 Jun 2020 15:49:19 +0000 Subject: [PATCH] Add documentation for pull #37371 --- translation/message_format.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/translation/message_format.rst b/translation/message_format.rst index 2b07f534ca0..abbfba942b7 100644 --- a/translation/message_format.rst +++ b/translation/message_format.rst @@ -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``