RFR: 8288882: JFileChooser - empty (0 bytes) file is displayed as 1 KB [v4]
Abhishek Kumar
duke at openjdk.org
Thu Jul 14 12:05:03 UTC 2022
On Wed, 13 Jul 2022 19:52:01 GMT, Andy Goryachev <duke at openjdk.org> wrote:
>> True plurals (as in LDML) is not yet fully supported in the JDK. (`CompactNumberFormat` does for its own purpose (https://bugs.openjdk.org/browse/JDK-8222756), but not for general use) For this case, I think `ChoiceFormat` is the mid-ground solution, as Swing is only localized in a handful of languages.
>
> another suggestion: to avoid locale-dependent complexity simply show the number of bytes as a number if length < 1000. this will also avoid involving the group separator - as far as I know, no language on earth uses group separator for numbers in the range 0...999
>
> 0 - "0"
> 1 - "1"
> 999 - "999"
> 1000 - "1 KB"
> etc.
ChoiceFormat has been used now to handle formatting of file size in plural forms. For file size either 0 or more than 1 byte it shows <file length> bytes else 1 byte.
@naotoj @andy-goryachev-oracle Please check if it is correct.
-------------
PR: https://git.openjdk.org/jdk/pull/9327
More information about the client-libs-dev
mailing list