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

Norwegian Nynorsk Locale is missing formatting

    XMLWordPrintable

Details

    • b21
    • generic
    • generic
    • Verified

    Backports

      Description

        A DESCRIPTION OF THE PROBLEM :
        Norwegian Nynorsk is a language in Norway: https://www.unicode.org/cldr/cldr-aux/charts/28/summary/nn.html and https://github.com/openjdk/jdk/blob/master/make/data/cldr/common/main/nn.xml
        Formatting should be similar to Norwegian Bokmål https://github.com/openjdk/jdk/blob/master/make/data/cldr/common/main/nb.xml
        In Java 17, 18 and 19 Norwegian Nynorsk defaults to English formatting when using BigDecimal, Integer and probably other types.

        REGRESSION : Last worked in version 11.0.16.1

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        import java.math.BigDecimal;
        import java.text.DecimalFormat;
        import java.text.NumberFormat;
        import java.util.Locale;

        public class JDKBug {

            public static void main(String args[]) {
                BigDecimal amount = new BigDecimal("2345.78");

                DecimalFormat norwegianNynorskAmountFormatter = getAmountFormatter(new Locale("nn", "NO"));
                System.out.println("Nynorsk amount formatting: " + norwegianNynorskAmountFormatter.format(amount));


                DecimalFormat norwegianBokmaalAmountFormatter = getAmountFormatter(new Locale("nb", "NO"));
                System.out.println("Bokmål amount formatting: " + norwegianBokmaalAmountFormatter.format(amount));
            }

            private static DecimalFormat getAmountFormatter(Locale locale) {
                NumberFormat nf = NumberFormat.getNumberInstance(locale);
                return (DecimalFormat) nf;
            }

        }

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Nynorsk amount formatting: 2 345,78
        Bokmål amount formatting: 2 345,78
        ACTUAL -
        Nynorsk amount formatting: 2,345.78
        Bokmål amount formatting: 2 345,78

        ---------- BEGIN SOURCE ----------
        See above source code
        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        Use Norwegian Bokmål locale for formatting.

        FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

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

                Dates

                  Created:
                  Updated:
                  Resolved: