What is Common Locale Data Repository (CLDR) in Java 9?


Internationalization enhancements for Java 9 include enabling of CLDR Locale Data by Default.

There are four distinct sources for locale data identified by using the below keywords:

  • CLDR: The locale data provided by a Unicode Common Locale Data Repository (CLDR) project.
  • HOST: The current user’s customization of an underlying operating system’s settings. Depending on the operating system, formats like date, time, number, and currency can be supported.
  • SPI: The locale-sensitive services implemented in installed SPI providers.
  • COMPAT (JRE): The locale data that is compatible with releases prior to Java 9. The JRE can still be used as a value but deprecated, and removed in the future.

In Java 8 and previous versions, JRE is default locale data. Java 9 sets CLDR as the highest priority by default. We select a locale data source in preferred order by using java.locale.providers system property. If a provider has failed to request locale data, the next provider can be processed.

java.locale.providers=COMPAT,CLDR,HOST,SPI


If we don’t set the property, the default behavior is:

java.locale.providers=CLDR,COMPAT,SPI


To make compatible with Java 8, keep COMPAT ahead of CLDR.

java.locale.providers=COMPAT,CLDR

Updated on: 12-Mar-2020

340 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements