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

@prsadhuk @naotoj @aivanov-jdk @andy-goryachev-oracle Messageformat has been 
used to format the string to work correctly for non-english locale also. 
Modified the basic.properties file to handle byte values.

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

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

Reply via email to