Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8295372

CompactNumberFormat handling of number one with decimal part

    XMLWordPrintable

Details

    • b20
    • generic
    • generic
    • Verified

    Description

      A DESCRIPTION OF THE PROBLEM :
      Certain languages such as DE, ES, IT, or PT treat the number 1.1 as plural. But JDK returns the long formats in singular form for these cases. E.g., expecting '1,1 millones' for ES but received '1,1 millón' instead.

      CLDR Standards:
      https://www.unicode.org/cldr/cldr-aux/charts/28/verify/numbers/es.html
      https://www.unicode.org/cldr/cldr-aux/charts/28/verify/numbers/de.html
      https://www.unicode.org/cldr/cldr-aux/charts/28/verify/numbers/it.html
      https://www.unicode.org/cldr/cldr-aux/charts/28/verify/numbers/pt.html
      ...


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Execute the provided test code to reproduce the error.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      1,1 millones
      ACTUAL -
      1,1 millón

      ---------- BEGIN SOURCE ----------
      import java.text.NumberFormat;
      import java.util.Locale;

      public class TestCompactNumberFormat {
          public static void main(String[] args) {
              NumberFormat fmt = NumberFormat.getCompactNumberInstance(
                      new Locale("es"), NumberFormat.Style.LONG);
              fmt.setMaximumFractionDigits(1);
              System.out.println(fmt.format(1_100_000));
          }
      }

      ---------- END SOURCE ----------

      FREQUENCY : always


      Attachments

        Issue Links

          Activity

            People

              naoto Naoto Sato
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: