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

Missing localized Japanese Era name in CLDR provider for Chinese/Korean locales

    Details

      Description

      With the fix of JDK-8218781, the localized Japanese Era names are introduced
      in Chinese and Korean locales in the COMPAT provider.

      However, using the CLDR provider, the Japanese Era is not displayed in these
      locales. The CLDR provider is not default in JDK 8 but this changes need to
      be applied to the CLDR provider to avoid inconsistency between both locale providers.

      $ cat LocalizedEra.java
      import java.util.*;
      import java.time.*;
      import java.time.chrono.*;
      import java.time.format.*;
      import java.time.temporal.*;
      import static java.util.Calendar.*;
      import static java.util.Locale.*;

      public class LocalizeEra {
        public static void main(String[] args) {
          Calendar c = new Calendar.Builder()
                  .setCalendarType("japanese")
                  .setFields(ERA, 5, YEAR, 1, MONTH, MAY, DAY_OF_MONTH, 1)
                  .build();

              String ja_l = c.getDisplayName(ERA, LONG, (Locale)JAPAN);
              String ja_s = c.getDisplayName(ERA, SHORT, (Locale)JAPAN);
              String ch_l = c.getDisplayName(ERA, LONG, (Locale)CHINA);
              String ch_s = c.getDisplayName(ERA, SHORT, (Locale)CHINA);
              String ko_l = c.getDisplayName(ERA, LONG, (Locale)KOREA);
              String ko_s = c.getDisplayName(ERA, SHORT, (Locale)KOREA);

              System.out.println("Japanese - " + ja_l + " - " + ja_s);
              System.out.println("Chinese - " + ch_l + " - " + ch_s);
              System.out.println("Korean - " + ko_l + " - " + ko_s);
         }
      }

      $ jdk1.8.0_221_x64/bin/java -Djava.locale.providers=COMPAT LocalizeEra
      Japanese - 令和 - R
      Chinese - 令和 - R
      Korean - 레이와 - R

      $ jdk1.8.0_221_x64/bin/java -Djava.locale.providers=CLDR LocalizeEra
      Japanese - Reiwa - 令和
      Chinese - Reiwa -
      Korean - Reiwa -

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                coffeys Sean Coffey
                Reporter:
                shadowbug Shadow Bug
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: