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

Host Locale Provider on Mac does not return translated values of Japanese calendar

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 14
    • 11, 14
    • core-libs
    • None
    • Mac OS/X

    • b23
    • x86_64
    • os_x

    Description

      FULL PRODUCT VERSION :
      openjdk version "14-ea" 2020-03-17
      OpenJDK Runtime Environment (build 14-ea+17-721)
      OpenJDK 64-Bit Server VM (build 14-ea+17-721, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Mac OS/X

      A DESCRIPTION OF THE PROBLEM :
      Even if OS sets Japanese language and Japanese calendar,
      Host Locale Provider on Mac returns English strings.

      Default Locale provider (CLDR) can show translated strings.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Open OS setting of language and region
          Set Japanese to Language.
          Set Japanese imperial calendar to Calendar.

      2. Execute the following sample code
      % jshell -R-Djava.locale.providers=HOST
      import java.text.DateFormat
      var calendar = Calendar.getInstance()
      var df = DateFormat.getDateInstance(DateFormat.FULL, Locale.getDefault())
      df.format(calendar.getTime())

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Expected:
      The values of Era and Day of week are translated.

      Actual:
      % jshell -R-Djava.locale.providers=HOST
      jshell> import java.text.DateFormat
      jshell> var calendar = Calendar.getInstance()
      calendar ==> java.util.JapaneseImperialCalendar[time=157181987 ... SET=32400000,DST_OFFSET=0]
      jshell> var df = DateFormat.getDateInstance(DateFormat.FULL, Locale.getDefault())
      df ==> java.text.SimpleDateFormat@de9db2c9
      jshell> df.format(calendar.getTime())
      $4 ==> "Reiwa1年10月23日 Wednesday"
      The values of Era and Day of week are in English.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      Attachments

        Activity

          People

            naoto Naoto Sato
            tnakamura Toshio Nakamura
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: