<i18n dev> RFR: 6230751: [Fmt-Ch] Recursive MessageFormats in ChoiceFormats ignore indicated subformats

Justin Lu jlu at openjdk.org
Wed Nov 29 22:47:21 UTC 2023


Please review this PR which updates an incorrect code example in _java/text/ChoiceFormat_.

ChoiceFormat (and MessageFormat) provide an example of how to produce a pattern that supports singular and plural forms. The ChoiceFormat example is incorrect, as recursive MessageFormats produced by a ChoiceFormat subformat only recognize subformats defined through the MessageFormat pattern syntax, not through the subformats contained within the top level MessageFormat. 

In the original example,
`Format[] testFormats = {fileform, null, NumberFormat.getInstance()};` could have been replaced with 
`Format[] testFormats = {fileform, null, new ChoiceFormat("0#BROKEN")};` and the original output would have been the same.

This PR replaces the example with the one used in MessageFormat, which is correct. 

This PR also includes a drive-by fix to remove leftover `<blockquote>`s from a previous `@snippet` conversion.

-------------

Commit messages:
 - change var name in trailing example
 - replace '.' with ':'
 - init

Changes: https://git.openjdk.org/jdk/pull/16891/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16891&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-6230751
  Stats: 55 lines in 2 files changed: 1 ins; 29 del; 25 mod
  Patch: https://git.openjdk.org/jdk/pull/16891.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/16891/head:pull/16891

PR: https://git.openjdk.org/jdk/pull/16891


More information about the i18n-dev mailing list