Skip to content

Commit 9fe46e9

Browse files
committed
minor #14072 [Translation] The 'other' key is mandatory in ICU 'select' (javiereguiluz)
This PR was merged into the 4.4 branch. Discussion ---------- [Translation] The 'other' key is mandatory in ICU 'select' In a new Symfony app I worked on recently, we use ICU intl messages. Symfony makes it super easy to use and everything works perfectly. Thanks to everybody who made it possible! However, when using `select`, the `other` key is mandatory. In some messages of my app we only have two options, so I didn't add `other` at first ... and I saw this: ![image](https://user-images.githubusercontent.com/73419/90253477-8000d480-de41-11ea-94c0-faa7adb517d4.png) This option being mandatory is mentioned in http://userguide.icu-project.org/formatparse/messages and https://messageformat.github.io/messageformat/page-guide#toc3__anchor so we may do the same. Commits ------- cf8cba0 [Translation] The 'other' key is mandatory in ICU 'select'
2 parents 21c286f + cf8cba0 commit 9fe46e9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

translation/message_format.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ typical usage of this is gender:
100100
.. code-block:: yaml
101101
102102
# translations/messages+intl-icu.en.yaml
103+
104+
# the 'other' key is required, and is selected if no other case matches
103105
invitation_title: >-
104106
{organizer_gender, select,
105107
female {{organizer_name} has invited you for her party!}
@@ -116,6 +118,7 @@ typical usage of this is gender:
116118
<body>
117119
<trans-unit id="invitation_title">
118120
<source>invitation_title</source>
121+
<!-- the 'other' key is required, and is selected if no other case matches -->
119122
<target>{organizer_gender, select,
120123
female {{organizer_name} has invited you for her party!}
121124
male {{organizer_name} has invited you for his party!}
@@ -130,6 +133,7 @@ typical usage of this is gender:
130133
131134
// translations/messages+intl-icu.en.php
132135
return [
136+
// the 'other' key is required, and is selected if no other case matches
133137
'invitation_title' => '{organizer_gender, select,
134138
female {{organizer_name} has invited you for her party!}
135139
male {{organizer_name} has invited you for his party!}

0 commit comments

Comments
 (0)