RFR: 8288882: JFileChooser - empty (0 bytes) file is displayed as 1 KB
Naoto Sato
naoto at openjdk.org
Thu Jun 30 16:27:41 UTC 2022
On Thu, 30 Jun 2022 16:19:44 GMT, Andy Goryachev <duke at openjdk.org> wrote:
>> The code should employ `MessageFormat`. You only need to modify the English resource bundles, i.e., `basic.properties`, the rest will be taken care of by the g11n process.
>
> In this case, I would suggest to use straight number.
>
> If you notice, the lengths are listed as {0} KB, {0} MB, {0} GB (there are no terabytes, I see), and "1023 bytes" would make the string too long and might case ellipses to appear.
>
> Also, the threshold might be set at <= 999 instead of 1024. The reason is group separator - the user might prefer to see 1,023 instead of 1023.
>
> Ideally, there should be a pluggable policy (formatter) to format the lengths to the user's liking.
>
> To summarize,
> 0...999 -> "0" ... "999"
> 1000 ... 1023 -> "1 KB"
Another option is to use `java.text.CompactNumberFormat` which can handle those K/M/B suffixes nicely.
-------------
PR: https://git.openjdk.org/jdk/pull/9327
More information about the client-libs-dev
mailing list