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

Month value is inconsistent between CLDR and Java in some special locales

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 11
    • 9
    • core-libs
    • b12
    • generic
    • generic
    • Verified

      Steps:
      Tests Month value by type consistency between CLDR and Java, using "JANUARY" and "SHORT" as input.
      For example: on language tag pa-PK. As CLDR's definition, locale pa_PK will be replaced to pa_Arab_PK in supplementalMetadata.xml file. There is no element of monthContext [@type=format]/monthWidth[@type=abbreviated]/month[@type=1] in pa_Arab_PK.xml file, but as CLDR fallback mechanism, should fall back to pa_Arab.xml file, but still there isn't abbreviated month in pa_Arab.xml, and then fallback to root.xml as CLDR defined, then should return "wide" type instead "abbreviated", so the result should be جنوری

      The issue happens on locale pa-PK, sr-ME, uz-AF. The reason looks like Java doesn't handle languageAlias.

      To compare the output format in Java, by running below code.
      public void getMonthElement() {
              String tag= "pa-PK";

              Locale target = Locale.forLanguageTag(tag);

              Month day = Month.valueOf("JANUARY");
              TextStyle style = TextStyle.valueOf("SHORT");
              String actualResult = day.getDisplayName(style, target);
              System.out.println(actualResult);
          }

      Result:
      The output of Java is "ਜਨ", instead of جنوری.

            rgoel Rachna Goel (Inactive)
            yzhou Daisy Zhou (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: