@@ -100,9 +100,10 @@ typical usage of this is gender:
100
100
# the 'other' key is required, and is selected if no other case matches
101
101
invitation_title : >-
102
102
{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!}
106
107
}
107
108
108
109
.. code-block :: xml
@@ -116,9 +117,10 @@ typical usage of this is gender:
116
117
<source >invitation_title</source >
117
118
<!-- the 'other' key is required, and is selected if no other case matches -->
118
119
<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!}
122
124
}</target >
123
125
</trans-unit >
124
126
</body >
@@ -131,9 +133,10 @@ typical usage of this is gender:
131
133
return [
132
134
// the 'other' key is required, and is selected if no other case matches
133
135
'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!}
137
140
}',
138
141
];
139
142
@@ -152,6 +155,12 @@ select. This function is applied over the ``organizer_gender`` variable::
152
155
// prints "John & Jane have invited you to their party!"
153
156
echo $translator->trans('invitation_title', [
154
157
'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',
155
164
'organizer_gender' => 'not_applicable',
156
165
]);
157
166
@@ -170,7 +179,7 @@ you to use literal text in the select statements:
170
179
While it might seem more logical to only put ``her ``, ``his `` or ``their ``
171
180
in the switch statement, it is better to use "complex arguments" at the
172
181
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
174
183
parts of the sentence might be influenced by the variables.
175
184
176
185
.. tip ::
@@ -179,12 +188,13 @@ you to use literal text in the select statements:
179
188
without having to define them in any file::
180
189
181
190
$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!}
185
195
}';
186
196
187
- // prints "Ryan has invited you for his party!"
197
+ // prints "Ryan has invited you to his party!"
188
198
echo $translator->trans($invitation, [
189
199
'organizer_name' => 'Ryan',
190
200
'organizer_gender' => 'male',
0 commit comments