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

Unicode BCP 47 U Extension Enhancements

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 10
    • core-libs
    • None
    • minimal
    • Since this is new, the compatibility risk is minimal.
    • Java API
    • SE

      Summary

      Upgrade the support for the Unicode locale extension (BCP47 'U' extension) in Java SE and the JDK.

      Problem

      As of Java SE 9, Unicode locale extension support is limited to "ca" (calendar) and "nu" (numbers) in java.text/java.util packages, Support for "ca" is missing in java.time package. Also there are other extensions that are relevant to JDK which have not been implemented.

      Solution

      Extend the support for the U extensions to the latest LDML specification in relevant JDK classes. This CSR intends to add the support for the following U extensions.

      • cu (Currency type)
      • fw (First day of week)
      • rg (Region Override)
      • tz (Time Zone)

      In order to support those additional Unicode locale extensions, changes will be made in the following JDK classes:

      • java.text.DateFormat: get*Instance() will return instance based on the extensions (-ca, -rg and/or -tz)
      • java.text.DateFormatSymbols: getInstance() will return instance based on the extension (-rg)
      • java.text.DecimalFormatSymbols: getInstance() will return instance based on the extension (-rg)
      • java.text.NumberFormat: get*Instance() will return instance based on the extensions (-nu and/or -rg)
      • java.time.format.DateTimeFormatter: withLocale(Locale)/ofPattern() will return a DateTimeFormatter instance based on the extensions (-ca, -rg and/or -tz)
      • java.time.format.DateTimeFormatterBuilder: toFormatter() will return a DateTimeFormatter instance based on the extensions (-ca, -rg and/or -tz)
      • java.time.temporal.WeekFields: of(Locale) will return a WeekFields instance based on the extensions (-fw and/or -rg) in the designated Locale instance.
      • java.util.Calendar: getFirstDayOfWeek()/getMinimalDaysInWeek() will return the values based on the extensions (-fw and/or -rg) in the associated Locale instance.
      • java.util.Currency: getInstance(Locale) will return a Currency instance based on the extensions (-cu and/or -rg) in the designated Locale instance.
      • java.util.Locale: getDisplayName() will return a String that contains display names for those U extensions.
      • java.util.spi.LocaleNameProvider() will have new SPIs for keys/types of the U extensions.

      Although the localized display names will be provided, specifying the U extensions other than the above ones in locale sensitive APIs has no effect.

      Specification

      Attached specdiff.zip. Also it is viewable at http://cr.openjdk.java.net/~naoto/8176841/specdiff.04/

            naoto Naoto Sato
            naoto Naoto Sato
            Alan Bateman, Nishit Jain, Roger Riggs
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: