RFR: 8288882: JFileChooser - empty (0 bytes) file is displayed as 1 KB

Andy Goryachev duke at openjdk.org
Thu Jun 30 16:23:43 UTC 2022


On Thu, 30 Jun 2022 16:09:51 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>>> > Also, will this code work correctly for non-English locales?
>>> 
>>> It won't.
>>> 
>>> It has to use `MessageFormat` and it has to add a new string to the resource bundle.
>> 
>> Yeah, I will check on this
>
> 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"

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

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



More information about the client-libs-dev mailing list