Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8244245 localizedBy() should override localized values with default values
  3. JDK-8244555

Release Note: localizedBy() Overrides Localized Values With Default Values

XMLWordPrintable

    • generic
    • generic
    • Verified

      `java.time.format.DateTimeFormatter.localizedBy(Locale)` method now honors the default locale values, such as `Chronology`and/or `DecimalStyle` of the specified locale argument.

      For example, in previous JDK releases:
      ```
      jshell> DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL)
          .localizedBy(Locale.forLanguageTag("fa"))
          .format(LocalDate.now())
      $3 ==> "جمعه 1 مهٔ 2020"
      ```
      the numbers are in Arabic (Western) numerals.
       
      In JDK 15:
      ```
      jshell> DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL)
          .localizedBy(Locale.forLanguageTag("fa"))
          .format(LocalDate.now())
      $3 ==> "جمعه ۱ مهٔ ۲۰۲۰"
      ```
      the numbers are in Extended Arabic-Indic numerals because it is the default numbering system for the Farsi locale.

            naoto Naoto Sato
            naoto Naoto Sato
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: