View ToC

Java 10 - Locale Enhancements


JEP 314 - Unicode Language-Tag Extensions

Java 7 introduced support for BCP 47 Language tags. But this unicode locale extensions was limited to calendar and numbers. With Java 10, java.util.Locale and related classes are updated to implement additional unicode extensions as specified in LDML specification. Following additional extensions are added.

  • cu − Currency Types

  • fw − First Day of a Week

  • rg − Region Override

  • tz − Time Zone

Following APIs are updated.

java.text.DateFormat::get*Instance
java.text.DateFormatSymbols::getInstance
java.text.DecimalFormatSymbols::getInstance
java.text.NumberFormat::get*Instance
java.time.format.DateTimeFormatter::localizedBy
java.time.format.DateTimeFormatterBuilder::getLocalizedDateTimePattern
java.time.format.DecimalStyle::of
java.time.temporal.WeekFields::of
java.util.Calendar::{getFirstDayOfWeek,getMinimalDaysInWeek}
java.util.Currency::getInstance
java.util.Locale::getDisplayName
java.util.spi.LocaleNameProvider