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

Abhishek Kumar duke at openjdk.org
Thu Jun 30 08:24:21 UTC 2022


On Thu, 30 Jun 2022 04:05:07 GMT, Prasanta Sadhukhan <psadhukhan 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.
>
> 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

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

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



More information about the client-libs-dev mailing list