On Fri, 2 Feb 2024 22:13:39 GMT, Justin Lu <j...@openjdk.org> wrote: > > Slightly tangential question (since you're talking about adding new > > subformats)... > > Has it ever been considered to add `MessageFormat` itself as a subformat > > option? > > It's not as crazy an idea as it sounds :) Here's an example: > > ```java > > MessageFormat f = new MessageFormat( > > "Result: {0,choice,0#no letters|1#one letter: {1,message,'{0}'}|2#two > > letters: {1,message,'{0} and {1}'}}"); > > f.format(new Object[] { 2, new Object[] { "A", "B" } }); // "Result: two > > letters: A and B" > > ``` > > Definitely an interesting idea, although I think the pattern syntax is > generally reserved for common use cases, I'm not sure if this would be that > common. Something to think about/consider though, although it would be beyond > the scope of this change.
I agree with Justin. Not that justifiable for our commitment in the future. BTW, the said example can nicely be handled with `ListFormat` IMO. ------------- PR Comment: https://git.openjdk.org/jdk/pull/17663#issuecomment-1924795058