On Wed, 29 Jun 2022 19:08:12 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:

>> src/java.desktop/share/classes/sun/swing/FilePane.java line 1198:
>> 
>>> 1196:                     text = MessageFormat.format(kiloByteString, len + 
>>> 1);
>>> 1197:                 } else if (len < 1024L) {
>>> 1198:                     text = (len == 0L) ? 0 + " bytes" : len + " 
>>> bytes";
>> 
>> Is this necessary?
>> 0 + " bytes" -->  "0 bytes"
>> 
>> Also, will this code work correctly for non-English locales?
>
>> 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

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

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

Reply via email to