<i18n dev> RFR: JDK-6285888: ChoiceFormat can support unescaped relational symbols in the Format segment [v2]

Naoto Sato naoto at openjdk.org
Wed Jan 31 17:55:02 UTC 2024


On Tue, 30 Jan 2024 23:09:17 GMT, Justin Lu <jlu at openjdk.org> wrote:

>> Please review this PR and [CSR](https://bugs.openjdk.org/browse/JDK-8314822) which allows for the _Format_ segment of a ChoiceFormat pattern to use the ChoiceFormat Relational symbols without the need to escape them using quotes. Previously, using a non escaped Relational symbol within a _Format_ segment would throw an IAE.
>> 
>> Implementation wise, this can be achieved by adding an additional check of `part == 0` to the relational symbol conditional. This is safe to do, as any subsequent relational symbols should only come after a '|' is parsed, which sets part back to 0. This ensures that for the duration of `part = 1` (Format segment), the relational symbols can be used without syntactic meaning.
>> 
>> For example, this change allows behavior such as: `new ChoiceFormat("1#The code is #7281")`. Previously, the workaround would have been new `ChoiceFormat("1#The code is '#'7281")` to achieve the same formatted behavior. Please see the CSR for more detail.
>> 
>> Additionally, this change also includes an unrelated grouping of the ChoiceFormat examples under a single header: **Usage Information**.
>
> Justin Lu has updated the pull request incrementally with one additional commit since the last revision:
> 
>   update wording on quoting behavior

LGTM

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

Marked as reviewed by naoto (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/17640#pullrequestreview-1854463383


More information about the i18n-dev mailing list