File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -187,6 +187,8 @@ you to use literal text in the select statements:
187187 It's possible to translate ICU MessageFormat messages directly in code,
188188 without having to define them in any file::
189189
190+ use Symfony\Component\Translation\MessageCatalogueInterface;
191+
190192 $invitation = '{organizer_gender, select,
191193 female {{organizer_name} has invited you to her party!}
192194 male {{organizer_name} has invited you to his party!}
@@ -195,10 +197,16 @@ you to use literal text in the select statements:
195197 }';
196198
197199 // prints "Ryan has invited you to his party!"
198- echo $translator->trans($invitation, [
199- 'organizer_name' => 'Ryan',
200- 'organizer_gender' => 'male',
201- ]);
200+ echo $translator->trans(
201+ $invitation,
202+ [
203+ 'organizer_name' => 'Ryan',
204+ 'organizer_gender' => 'male',
205+ ],
206+ // if you prefer, the required "+intl-icu" suffix is also defined as a constant:
207+ // Symfony\Component\Translation\MessageCatalogueInterface::INTL_DOMAIN_SUFFIX
208+ 'messages+intl-icu'
209+ );
202210
203211.. _component-translation-pluralization :
204212
You can’t perform that action at this time.
0 commit comments