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

java.util.Calendar.getDisplayName returns era name in English instead of Japanese name for style=LONG and Locale=JAPAN for CLDR as locale providers.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • None
    • 8-pool
    • core-libs
    • None

      java.util.Calendar.getDisplayName(int field, int style, Locale locale) returns era name in English instead of Japanese name. Below are the steps to reproduce the issue:-

      Set JVM parameter java.locale.providers=CLDR

      Calendar c = new Calendar.Builder()
                  .setCalendarType("japanese")
                  .setFields(ERA, 4, YEAR, 1, MONTH, MAY, DAY_OF_MONTH, 1)
                  .build();

      String eraName = c.getDisplayName(ERA, LONG, Locale.Japan);

      Actual Result :- The value of eraName is "Heise"

      Expected Result:- The value of eraName should be "平成"


      Root Cause of issue:-

      The cause of issue is that CLDR java resource file (FormatData_ja.java) generated by "CLDR Converter" does not contain required resource key "japanese.long.Eras". The "CLDR Converter" need to be fixed to address this issue.

            naoto Naoto Sato
            dkejriwal Deepak Kejriwal (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: