Joker
Joker

Reputation: 11146

What is Common Locale Data Repository (CLDR) - JDK 9

I want to understand CLDR as it is enhanced in JDK-9.

JDK 9 CLDR - As per JDK docs

In JDK 9, the default locale data uses data derived from the Unicode Consortium's Common Locale Data Repository (CLDR). As a result, users may see differences in locale sensitive services behavior and/or translations.

Can some one help me understand this and let me know what will be its reprecusion in JDK8 Date API.

Upvotes: 2

Views: 2707

Answers (2)

Joachim Sauer
Joachim Sauer

Reputation: 308001

The CLDR (Common Locale Data Repository) is a set of data collected by the Unicode Consortium that many libraries use to provide data related to internationalization.

Stuff that it contains are things like:

  • information on how dates/times are formatted in a given locale.
  • information on how sorting of text (collation) happens in a given locale
  • information on how numbers are represented in a given locale
  • names for currencies, units and geographic regions
  • ...

Note: a "locale" is basically "a language as spoken in a given region". It's a bit more involved than that, but that's a good high level language. "en-US" for example represents American English and "de-DE" is German as spoken in Germany.

The JDK has traditionally maintained its own set of data for that. That changed in Java 9 and later, with most implementations of Java now using the CLDR by default. See JEP 252: Use CLDR Locale Data by Default.

Having worked both with JDK data and CLDR data I can say that on average the CLDR data is much better, more actively maintained and (probably most importantly) it has a specified way on how to provide improvements or bug reports.

The practical difference of that is that some formatting might behave slightly differently than it did before, in most cases more correct, but possibly in unexpected ways. This will apply especially when using non-English languages (the effects of such a change on the English locale are rather small).

Upvotes: 7

Dragonthoughts
Dragonthoughts

Reputation: 2224

CLDR encapsulates the rules for sorting and formatting content for all the world (e.g. date and currency formats). This is a big data set that is closely tied to Unicode itself.

CLDR is designed to be a formal, stable set of these definitions.

Since the CLDR rules differ, in some cases for some locales, from those that were build into versions of Java 8 and before, they have provided that warning.

Upvotes: 1

Related Questions