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

Naoto Sato naoto at openjdk.org
Thu Jun 30 16:13:26 UTC 2022


On Thu, 30 Jun 2022 08:21:14 GMT, Abhishek Kumar <duke at openjdk.org> wrote:

>> Dont think this len==0 check is needed...
>> One can use text = len + "bytes";
>> 
>> Also, this has i18n connection to it, so you need to use "byteString" similar to "kiloByteString", point it to 
>> UIManager.getString("FileChooser.fileSizeBytes", l); and add "FileChooser.fileSizeBytes" entry into 
>> share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties
>> share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties
>> share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties
>> share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties
>> share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties
>> share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties
>> share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties
>> share/classes/com/sun/swing/internal/plaf/basic/resources/basic_pt_BR.properties
>> share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties
>> share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties
>> share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties
>> 
>> I am not sure if need i18n team's intervention to update those resources as "bytes" can be translated to native in jp, zh
>> Maybe @naotoj can throw some light on that how to go about updating those resource file
>
>> > 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.

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

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



More information about the client-libs-dev mailing list