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][2] 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/][4]
[1]: http://openjdk.java.net/projects/locale-enhancement/
[2]: http://www.unicode.org/reports/tr35/tr35.html#Locale_Extension_Key_and_Type_Data
[3]: http://www.oracle.com/technetwork/java/javase/documentation/java9locales-3559485.html
[4]: http://cr.openjdk.java.net/~naoto/8176841/specdiff.04/overview-summary.html