On Wed, 13 Jul 2022 16:54:48 GMT, Naoto Sato <na...@openjdk.org> wrote:

>> I would like to emphasize that this issue is complicated.  Plural rules vary 
>> from language to language, adding plural strings to resource bundles adds 
>> costs in terms of translation and testing.  
>> 
>> If we were to support proper plurals, one may use ChoiceFormat, though it 
>> seems to fail for Polish, see
>> https://stuartgunter.wordpress.com/2011/08/09/java-i18n-pluralisation-using-choiceformat/
>> 
>> Another solution is to pull in ICU4J library, see
>> https://stuartgunter.wordpress.com/2011/08/14/even-better-java-i18n-pluralisation-using-icu4j/
>> 
>> Yet another solution is to drop the words altogether and simply show a 
>> number (of bytes in this case).  Alternatively, use a common suffix such as 
>> "B", but this may not look standard.
>
> True plurals (as in LDML) is not yet fully supported in the JDK. 
> (`CompactNumberFormat` does for its own purpose 
> (https://bugs.openjdk.org/browse/JDK-8222756), but not for general use) For 
> this case, I think `ChoiceFormat` is the mid-ground solution, as Swing is 
> only localized in a handful of languages.

another suggestion: to avoid locale-dependent complexity simply show the number 
of bytes as a number if length < 1000.  this will also avoid involving the 
group separator - as far as I know, no language on earth uses group separator 
for numbers in the range 0...999

0 - "0"
1 - "1"
999 - "999"
1000 - "1 KB"
etc.

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

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

Reply via email to