Skip to content

Commit d2c631b

Browse files
committed
Merge branch '6.1' into 6.2
* 6.1: Improve the grammar in the example messages
2 parents 3a3c990 + 08affd0 commit d2c631b

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

translation/message_format.rst

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,10 @@ typical usage of this is gender:
100100
# the 'other' key is required, and is selected if no other case matches
101101
invitation_title: >-
102102
{organizer_gender, select,
103-
female {{organizer_name} has invited you to her party!}
104-
male {{organizer_name} has invited you to his party!}
105-
other {{organizer_name} have invited you to their party!}
103+
female {{organizer_name} has invited you to her party!}
104+
male {{organizer_name} has invited you to his party!}
105+
multiple {{organizer_name} have invited you to their party!}
106+
other {{organizer_name} has invited you to their party!}
106107
}
107108
108109
.. code-block:: xml
@@ -116,9 +117,10 @@ typical usage of this is gender:
116117
<source>invitation_title</source>
117118
<!-- the 'other' key is required, and is selected if no other case matches -->
118119
<target>{organizer_gender, select,
119-
female {{organizer_name} has invited you to her party!}
120-
male {{organizer_name} has invited you to his party!}
121-
other {{organizer_name} have invited you to their party!}
120+
female {{organizer_name} has invited you to her party!}
121+
male {{organizer_name} has invited you to his party!}
122+
multiple {{organizer_name} have invited you to their party!}
123+
other {{organizer_name} has invited you to their party!}
122124
}</target>
123125
</trans-unit>
124126
</body>
@@ -131,9 +133,10 @@ typical usage of this is gender:
131133
return [
132134
// the 'other' key is required, and is selected if no other case matches
133135
'invitation_title' => '{organizer_gender, select,
134-
female {{organizer_name} has invited you to her party!}
135-
male {{organizer_name} has invited you to his party!}
136-
other {{organizer_name} have invited you to their party!}
136+
female {{organizer_name} has invited you to her party!}
137+
male {{organizer_name} has invited you to his party!}
138+
multiple {{organizer_name} have invited you to their party!}
139+
other {{organizer_name} has invited you to their party!}
137140
}',
138141
];
139142
@@ -152,6 +155,12 @@ select. This function is applied over the ``organizer_gender`` variable::
152155
// prints "John & Jane have invited you to their party!"
153156
echo $translator->trans('invitation_title', [
154157
'organizer_name' => 'John & Jane',
158+
'organizer_gender' => 'multiple',
159+
]);
160+
161+
// prints "ACME Company has invited you to their party!"
162+
echo $translator->trans('invitation_title', [
163+
'organizer_name' => 'ACME Company',
155164
'organizer_gender' => 'not_applicable',
156165
]);
157166

@@ -170,7 +179,7 @@ you to use literal text in the select statements:
170179
While it might seem more logical to only put ``her``, ``his`` or ``their``
171180
in the switch statement, it is better to use "complex arguments" at the
172181
outermost structure of the message. The strings are in this way better
173-
readable for translators and, as you can see in the ``other`` case, other
182+
readable for translators and, as you can see in the ``multiple`` case, other
174183
parts of the sentence might be influenced by the variables.
175184

176185
.. tip::
@@ -179,12 +188,13 @@ you to use literal text in the select statements:
179188
without having to define them in any file::
180189

181190
$invitation = '{organizer_gender, select,
182-
female {{organizer_name} has invited you for her party!}
183-
male {{organizer_name} has invited you for his party!}
184-
other {{organizer_name} have invited you for their party!}
191+
female {{organizer_name} has invited you to her party!}
192+
male {{organizer_name} has invited you to his party!}
193+
multiple {{organizer_name} have invited you to their party!}
194+
other {{organizer_name} has invited you to their party!}
185195
}';
186196

187-
// prints "Ryan has invited you for his party!"
197+
// prints "Ryan has invited you to his party!"
188198
echo $translator->trans($invitation, [
189199
'organizer_name' => 'Ryan',
190200
'organizer_gender' => 'male',

0 commit comments

Comments
 (0)