<i18n dev> [14] RFR: 8222756: Plural support in CompactNumberFormat

Joe Wang huizhe.wang at oracle.com
Wed Dec 4 18:12:03 UTC 2019


Hi Naoto,

Looks good. I understand you'll update the webrev (with the added 
statement to readObject) once the CSR is approved.

ResourceBundleGenerator.java might have been accidentally touched as 
there's no change there.

I wonder if you need to guard the pluralRules input since you're 
building a Map with a split. While it normally won't be a problem if the 
factory methods are used, there's still a chance CompactNumberFormat is 
constructed directly (e.g. with a custom format).

Best,
Joe

On 11/26/19 1:35 PM, naoto.sato at oracle.com wrote:
> I modified CompactNumberFormat.java to simplify the syntax parsing:
>
> https://cr.openjdk.java.net/~naoto/8222756/webrev.01/
>
> Please review this webrev instead.
>
> Naoto
>
> On 11/25/19 1:16 PM, naoto.sato at oracle.com wrote:
>> Hello,
>>
>> CompactNumberFormat has been added since JDK 12 to support compact 
>> number formatting, such as 10_000 being formatted as "10K." [1] It 
>> works fine for English, however, not for other languages that take 
>> plural forms in formatted number prefixes/suffixes. In order to fix 
>> this, I filed the following CSR to extend the current 
>> CompactNumberFormat spec:
>>
>> https://bugs.openjdk.java.net/browse/JDK-8232633
>>
>> It basically accommodates the plural prefix/suffix forms into the 
>> existing compact patterns array, so that the existing compact number 
>> format works compatibly. The plural rules are solely based on the 
>> CLDR's plural language rules [2]
>>
>> Here is the implementation of the CSR:
>>
>> https://cr.openjdk.java.net/~naoto/8222756/webrev.00/
>>
>> Please review the CSR as well as its implementation.
>>
>> Naoto
>>
>>
>> [1] https://bugs.openjdk.java.net/browse/JDK-8177552
>> [2] 
>> https://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules



More information about the i18n-dev mailing list