Closed rumpfc closed 1 week ago
Note that the start and end parts are the same in English. That may not be true in other languages.
From "Why MessageFormat needs a successor"
select and plural placeholders inside a message are difficult to translate as grammatical agreement may require words outside the select/plural to change. See https://en.wikipedia.org/wiki/Agreement_(linguistics)
Translating split messages is already difficult for readability reasons, but this additional agreement issue can make things much worse.
Ok, I understand the decision behind this. Makes sense to keep syntax simple. Thanks for letting me know.
I consider using ICU MF2 in a PoC of mine for building automatic messages. Looking forward to your progress.
I experimented a bit with the new MessageFormat 2.0 syntax (using ICU4J 75.1). The pattern is
I can see how every option starts with
You have
, so I tried to put that part at the front of the match expression, but that results in a parsing errorWhat would be the correct syntax in such a situation? Or am I required to write the complete pattern even though start/end parts are the same?
Example Java code